EditorCanvas.tsx — 3 imported drawing functions never called + no ResizeObserver so canvas doesn't reflow on window resize + onDragEnd prop missing for #90 fix #93
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#93
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Where:
src/components/editor/EditorCanvas.tsx.Bug: Three issues found in the canvas component while walking the Editor.
Bug 1 — Three drawing functions are imported but never called. L4-13:
grep -n 'drawUnderlayPath\|drawSequenceBadge\|drawAnimationDot' src/components/editor/EditorCanvas.tsxreturns only the import lines — no call sites. The draw effect (L267-341) callsdrawDotGrid, drawHoop, drawPath, drawNewPathNodes, drawRubberBand, drawSelectionBox— never the three unimplemented ones. Consequences:drawAnimationDot: the user clicks Play in the Sequence panel, the rAF loop runs,sequenceState.progressadvances — but no progress dot appears on the canvas becausedrawAnimationDotis never invoked. Sequence playback has no visual feedback. Same family as #91's dead Sequence branch — both render empty when the user expects animation.drawSequenceBadge: sequence number badges (the small circle "1", "2", "3" near each path start) never render. The Sequence Order list in the right panel (also dead per #91) is the only place the order would be visible, but the canvas itself doesn't show badges.drawUnderlayPath: underlay ghost-render never appears. Thepath.underlay.enabledflag is plumbed butdrawUnderlayPathisn't invoked from the draw loop. With the Editor's 'underlay' mode being unreachable (#91), this is moot — but if a future change wires up underlay editing, the visualizer is missing.These three functions are fully implemented in
canvasRenderer.ts(drawUnderlayPath at L241-281, drawSequenceBadge at L283-324, drawAnimationDot at L326-368) but unused. ~130 lines of canvasRenderer code that doesn't reach the screen.Bug 2 — No ResizeObserver on the canvas container; canvas doesn't reflow when the window resizes. The draw effect at L267-341 has
[offset, scale, paths, mode, ...]as deps — none of these change on window resize. Theresize()function inside the effect computes canvas dimensions fromcontainerRef.current.clientWidth/Height(L275) but only runs when the deps change.Symptom: open the Editor at 1280×800 — canvas correctly fills the container. Resize the browser to 1600×900 — canvas backing store stays at 1280×800 (with empty space at right and bottom). Drawn content stays at the old position. Resizing back to 1280×800 doesn't restore either, because no observer fires.
There is no
ResizeObserver, nowindow.addEventListener('resize', …), nocontainerRef.current?.addEventListener('resize', …). Grep confirms:The Workspace canvas (
CanvasArea.tsx) likely has the same bug — out of scope for this issue but worth filing separately.Bug 3 —
handleMouseUp(L230-240) callsonDragEnd?.(dragNodeId)butonDragEndis not declared onEditorCanvasProps(L15-37) and Editor.tsx never passes it. The handler exists:onDragEnd?.()is optional-chained; if Editor doesn't pass it, nothing happens. This is the receive-side for the fix proposed in #90 (handleNodeDrag pushes history on every pixel — paired fix is to bracket a single history entry per gesture via onDragStart/onDragEnd callbacks). #90's fix can't land without first adding theonDragEnd(and matchingonDragStart) props toEditorCanvasProps. Without them, the Editor can't capture the pre-drag snapshot once.Fix consistent with existing patterns:
For Bug 1, inside the existing useEffect draw loop, after the path-draw call (L302) but before the sequence-animation handling:
For Bug 2, add a ResizeObserver in the same useEffect:
For Bug 3, extend
EditorCanvasProps(L15-37):Call
onDragStart(found.node.id)inhandleMouseDownat L169 (aftersetIsDragging(true)). The handleMouseUp side is already done — just needs the prop in Editor.tsx:519-541 to be passed once Editor.tsx adds adragStartSnapshotRef.Severity: Bug 1 = medium (visually missing sequence feedback), Bug 2 = medium (canvas out-of-sync after resize), Bug 3 = blocks #90's proper fix.
Cross-references: #89 (Editor undo/redo setPaths), #90 (drag-history pollution), #91 (dead Sequence/Underlay branches).