Canvas unification — Phase 4c: select & move frames - #10
Conversation
Make the mind map / flowchart frames first-class objects on the unified canvas: click to select (dashed outline), drag to reposition (updates the frame origin as one undo step). A hit-rect over each frame's content bbox captures the press; the content renders read-only underneath. - DiagramCanvas: per-frame content bbox (mmBox from mind-map positions, fcBox from flowchartContentBounds), a selectable/draggable hit-rect, live drag via window listeners folding a delta into the rendered origin, commit on pointer-up. Clear the frame selection on an empty-surface press. - store: moveFrame(kind, dx, dy) repositions a frame's origin (one undo step). - fix: the frame content is now genuinely non-interactive. The viewport's [&_*]:pointer-events-auto utility was re-enabling every descendant (mind-map "+" handles fired through the frame); a .unified-frame-content rule with pointer-events:none !important overrides it so the frame's hit-rect owns the press. Verified: build + 101 unit tests + live app — a mind-map frame selects (blue dashed outline, no stray node handles) and drags, moving its origin by exactly the drag delta (+160,+96), committed as one step; no page errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Confidence Score: 3/5The frame-selection drag logic is solid, but the flowchart content remains interactable through the hit-rect, leaving the stated pointer-events fix incomplete for that frame type. The mind-map frame gets the !important CSS override via .unified-frame-content, but FlowchartLayer is only wrapped in an inline style that silences the wrapper element while Tailwind's [&_*]:pointer-events-auto re-enables all descendants. Flowchart node handles can still fire through the frame, which is the exact regression the PR describes fixing. frontend/src/components/canvas/DiagramCanvas.vue — the flowchart frame content wrapper needs the .unified-frame-content class instead of the inline style. Reviews (1): Last reviewed commit: "Frappe Draw: canvas unification phase 4c..." | Re-trigger Greptile |
| <g style="pointer-events: none"> | ||
| <FlowchartLayer :flowchart="store.state.flowchart" /> | ||
| </g> |
There was a problem hiding this comment.
The flowchart content uses an inline
style="pointer-events: none" on the wrapper <g>, but inline styles only silence that one element — descendants of FlowchartLayer are still re-enabled by the viewport's [&_*]:pointer-events-auto Tailwind utility. The PR's own CSS fix (.unified-frame-content * { pointer-events: none !important }) is applied correctly to the mind-map wrapper but completely missed for the flowchart, so flowchart node handles and buttons still fire through the frame hit-rect.
| <g style="pointer-events: none"> | |
| <FlowchartLayer :flowchart="store.state.flowchart" /> | |
| </g> | |
| <g class="unified-frame-content"> | |
| <FlowchartLayer :flowchart="store.state.flowchart" /> | |
| </g> |
What & why
Make the mind map / flowchart frames first-class objects on the unified canvas: click to select (dashed outline), drag to reposition (updates the frame origin, one undo step). Completes the "frames/containers" model.
Changes
DiagramCanvas.vue: per-frame content bbox (mmBoxfrom mind-map positions,fcBoxfromflowchartContentBounds); a selectable/draggable hit-rect per frame; live drag via window listeners folding a delta into the rendered origin, commit on pointer-up; clear frame selection on empty-surface press.useDiagramStore.js:moveFrame(kind, dx, dy)repositions a frame's origin (one undo step).[&_*]:pointer-events-autoutility was re-enabling every descendant (mind-map "+" handles fired through the frame); a.unified-frame-content { pointer-events: none !important }rule overrides it so the frame's hit-rect owns the press.Testing
{500,350}→{660,446}), committed as one undo step; no page errors (screenshots).Phase 4 status
With 4a (frame model), 4b (render frames), 4c (select+move), 4d (Insert menu) merged, the canvas unification is functionally complete: one canvas with block shapes, whiteboard ink, and movable mind-map/flowchart frames you add from an Insert menu. Follow-up (future): in-frame node editing on the unified canvas (currently frames are read-only there; edit them as a dedicated single-type doc).
🤖 Generated with Claude Code