handleNodeDrag pushes history on every incremental mouse-move (~200 entries per 100px drag); no drag-start/drag-end signal #90
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#90
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/pages/Editor.tsx:243-258(handleNodeDrag),src/components/editor/EditorCanvas.tsx:184-223(handleMouseMove).Bug:
EditorCanvas.handleMouseMovecallsonNodeDrag(dragNodeId, dx, dy)whenever the mouse moves more than ~0.5 px from the last drag sample (EditorCanvas.tsx:199-205), passing the incremental delta and resettingdragStartto the current position. Each call lands inEditor.handleNodeDrag:A 100 px drag fires ~200
onNodeDragcalls. Each one pushes the pre-drag-steppathsto history. So a single gesture creates ~200 history entries. WithHISTORY_LIMIT = 50(Editor.tsx:182), the first 150 entries get shifted off, leaving the last 50 to be intermediate-step snapshots. Undo (when #89 lands) would step through ~50 sub-pixel-offset states per gesture.There is no drag-start/drag-end signal between
EditorCanvasandEditor.EditorCanvas.handleMouseUp(EditorCanvas.tsx:225-232) only resets local state — it never calls aonDragEndcallback.Editortherefore cannot distinguish "first pixel of a drag" from "200th pixel of the same drag."Symptom (once #89 is fixed): dragging a node 100 px right, then pressing Ctrl+Z once, would only roll back ~0.5 px. The user would need to press Undo ~200 times to fully revert. Most users will assume Undo is broken (the same false-positive symptom #89 already has).
Severity: medium. Doesn't break anything visible today (because #89 makes Undo a no-op anyway). Once Undo is fixed, this becomes a UX disaster: every drag gesture fills the history buffer with one-snapshot-per-pixel noise, and the user has to mash Ctrl+Z to revert a single move.
Fix consistent with existing patterns: Add a
dragNodeId: string | nullprop andonDragStart?: (nodeId: string) => void/onDragEnd?: (nodeId: string) => voidcallbacks toEditorCanvasProps(EditorCanvas.tsx:15-37). InEditorCanvas.handleMouseDown(line 169), callonDragStart(found.node.id)right aftersetIsDragging(true). InhandleMouseUp(line 225-232), callonDragEnd(dragNodeId)before resetting state. Then inEditor.tsx:Same shape applies to
handleCanvasClick/handleFinishPathif those also drag (path-drawing mode emits aonCanvasClickper click — already pushes per click, which is correct for discrete clicks but not for any continuous gesture).Cross-reference: Pair this with #89 (undo/redo setPaths fix). When both land, dragging and undoing should produce one history entry per gesture, with the full drag range as the unit of undo. Today the user sees neither; once #89 lands without this fix, they'll see "Undo moves the node 0.5 px per click."