Step 8 - operations
1 min czytania
Add the remaining editing operations. Each one goes through addEl/updateEl/deleteEl and produces exactly one undo entry.
- Duplicate (Ctrl/Cmd+D): cloneElement(el, dx=20, dy=20) with fresh ids; when duplicating a set, remap fromId/toId of any cloned connections through an old-id -> new-id map.
- Copy/paste (Ctrl/Cmd+C/V): in-memory clipboard of BoardElement[] (no system clipboard). Paste offsets by 20,20 with the same id-remap. Only preventDefault when there is actually a selection (copy) or clipboard content (paste) so normal text copy still works.
- Z-order: bring-to-front / send-to-back for the selection - adjust the z field relative to the max/min z within the element's own paint band.
- Group/ungroup: assign/remove a shared groupId; grouped elements select and move together.
- Lock/unlock toggle (facilitator pins reference material).
- Dashed toggle for lines, arrows and connections.
- Eraser tool: drag a circle; whole elements under it are deleted, EXCEPT freehand paths, which are clipped: compute where the polyline crosses the eraser rim and keep the surviving runs as new path elements (erasePathAt in the util module, with specs). Also delete any connection whose fromId/toId element was erased (withDanglingConnections helper).
- Clear board: confirmation dialog, deletes all elements, wipes both history stacks.
- Bulk sticky import: a dialog where each pasted line becomes one note, laid out in a grid centered on the current view.
- Context menu / floating action bar on selection exposing: duplicate, delete, lock, group, z-order, dashed.
Full shortcut set now active: Delete/Backspace, Ctrl/Cmd+Z/Shift+Z/Y, C, V, D, A, Escape - ALL suppressed while typing in any input/textarea (one isTypingTarget helper used everywhere).
Acceptance: every operation works, undoes as one step, and erasing through the middle of a pen stroke leaves two clean stroke segments.
Dyskusja
Komentarze: 0Brak komentarzy. Rozpocznij dyskusję.