Editor has no path split/merge operations — scissors tool cuts a path at one segment but you can't split into two separate paths or merge two selected paths into one #204

Closed
opened 2026-10-03 23:59:32 +00:00 by Mark · 1 comment
Owner

Finding

src/components/editor/EditorCanvas.tsx's Scissors mode (mode === 'scissors') cuts a path at the segment the user clicks. The handler calls onAddNodeAt (line 252), which inserts a new node at the click point.

grep -n 'splitPath\|SPLIT_PATH\|mergePath\|MERGE_PATH\|joinPath' src/ returns 0 hits. The Editor has no:

  • "Split path into two paths at the selected node" operation
  • "Merge two selected paths into one" operation

A user with two closed sub-paths they want to combine into one continuous path has to:

  1. Copy the nodes of path B
  2. Delete path B
  3. Open path A in the editor
  4. Append the nodes from B to A
  5. Adjust node types at the join

…or redraw from scratch. There's no "merge" affordance.

Similarly, a user with a long path that should be two separate paths (e.g., a flower stem + leaves) can't split it without manual node manipulation.

Where

  • Scissors tool: src/components/editor/EditorCanvas.tsx:252 (onAddNodeAt)
  • No split: grep -n 'SPLIT_PATH' src/ returns 0
  • No merge: grep -n 'MERGE_PATH\|joinPath' src/ returns 0
  • Path list: src/components/editor/EditorRightPanel.tsx:142-180 (no split/merge buttons)

Suggested fix shape

Split: in the right panel's "Path Properties" section, add a "Split Path" button next to "Add Node" / "Delete":

<button onClick={onSplitPathAtSelection} title="Split this path at the selected node">
  Split Path
</button>

onSplitPathAtSelection finds the selected path, takes the nodes after the selected node as a new path (with new id, same color, same stitch type), and pushes both to the array. Pushes history for undo.

Merge: requires multi-path selection (per #188). When 2+ paths are selected, the right panel shows a "Merge Paths" button that:

  • Sorts the selected paths by some criteria (e.g., their original index, or the first node's x)
  • Concatenates their node arrays into one
  • Deletes the originals
  • Creates a new path with the combined nodes

For a stitch-design app, "merge into one path" means combining all the segments into a single continuous polyline. The runtime treats merged paths as a single embroidery run; this changes the thread stops.

Severity

Medium-High. Power users with multi-path designs feel this immediately.

Discovered by

Gap analysis (2026-10-02) of editor path operations.

  • #187 (open) — Editor path duplicate. Same family of "missing path operations."
  • #188 (open) — Editor multi-path selection. Merge requires it.
  • #201 (open) — Editor path cycle. Sibling affordance.
  • The Scissors tool (#6) cuts at a segment; the "split" operation is a different surface (path-level, not segment-level).
## Finding `src/components/editor/EditorCanvas.tsx`'s Scissors mode (`mode === 'scissors'`) cuts a path at the segment the user clicks. The handler calls `onAddNodeAt` (line 252), which inserts a new node at the click point. `grep -n 'splitPath\|SPLIT_PATH\|mergePath\|MERGE_PATH\|joinPath' src/` returns 0 hits. The Editor has no: - "Split path into two paths at the selected node" operation - "Merge two selected paths into one" operation A user with two closed sub-paths they want to combine into one continuous path has to: 1. Copy the nodes of path B 2. Delete path B 3. Open path A in the editor 4. Append the nodes from B to A 5. Adjust node types at the join …or redraw from scratch. There's no "merge" affordance. Similarly, a user with a long path that should be two separate paths (e.g., a flower stem + leaves) can't split it without manual node manipulation. ## Where - Scissors tool: `src/components/editor/EditorCanvas.tsx:252` (`onAddNodeAt`) - No split: `grep -n 'SPLIT_PATH' src/` returns 0 - No merge: `grep -n 'MERGE_PATH\|joinPath' src/` returns 0 - Path list: `src/components/editor/EditorRightPanel.tsx:142-180` (no split/merge buttons) ## Suggested fix shape **Split**: in the right panel's "Path Properties" section, add a "Split Path" button next to "Add Node" / "Delete": ```tsx <button onClick={onSplitPathAtSelection} title="Split this path at the selected node"> Split Path </button> ``` `onSplitPathAtSelection` finds the selected path, takes the nodes after the selected node as a new path (with new id, same color, same stitch type), and pushes both to the array. Pushes history for undo. **Merge**: requires multi-path selection (per #188). When 2+ paths are selected, the right panel shows a "Merge Paths" button that: - Sorts the selected paths by some criteria (e.g., their original index, or the first node's x) - Concatenates their node arrays into one - Deletes the originals - Creates a new path with the combined nodes For a stitch-design app, "merge into one path" means combining all the segments into a single continuous polyline. The runtime treats merged paths as a single embroidery run; this changes the thread stops. ## Severity Medium-High. Power users with multi-path designs feel this immediately. ## Discovered by Gap analysis (2026-10-02) of editor path operations. ## Related - #187 (open) — Editor path duplicate. Same family of "missing path operations." - #188 (open) — Editor multi-path selection. Merge requires it. - #201 (open) — Editor path cycle. Sibling affordance. - The Scissors tool (#6) cuts at a segment; the "split" operation is a different surface (path-level, not segment-level).
Author
Owner

Shipped in commits 1902ca5 + 7749f49 on origin/main.

  • src/pages/Editor.tsx: handleSplitPathAtSelection requires exactly one selected node on the primary path and refuses to split at endpoints or split off a <2-node tail; handleMergeSelectedPaths concatenates the node arrays of every selected path in paths order, inherits the primary path's color/stitchType/density/underlay/sequence, and bumps sequence slots so playback order stays gap-free.
  • src/components/editor/EditorRightPanel.tsx: Split Path button next to Duplicate in the Selected Nodes row (disabled until exactly one node is selected on the primary path); Merge N Paths button at the top of the multi-selected Path Properties block.
  • 10 new vitest tests pinning the contract (render / disabled states / click dispatch / back-compat when handler omitted); full suite 963/963, tsc + eslint clean.

The split surface is intentionally distinct from the Scissors tool (#6) — Scissors inserts a node on the canvas at a clicked segment; Split is a path-level operation that requires an explicit node anchor from the right panel. Merge depends on multi-path selection added in #188.

Try: select 2+ paths in the Path List, click 'Merge N Paths' — the right panel confirms a single new path with concatenated nodes in design order. Or: select one path + one node, click 'Split Path' — the path cuts at that node into head + tail with both inheriting the source's color/density/stitchType.

Shipped in commits 1902ca5 + 7749f49 on origin/main. - src/pages/Editor.tsx: handleSplitPathAtSelection requires exactly one selected node on the primary path and refuses to split at endpoints or split off a <2-node tail; handleMergeSelectedPaths concatenates the node arrays of every selected path in `paths` order, inherits the primary path's color/stitchType/density/underlay/sequence, and bumps sequence slots so playback order stays gap-free. - src/components/editor/EditorRightPanel.tsx: Split Path button next to Duplicate in the Selected Nodes row (disabled until exactly one node is selected on the primary path); Merge N Paths button at the top of the multi-selected Path Properties block. - 10 new vitest tests pinning the contract (render / disabled states / click dispatch / back-compat when handler omitted); full suite 963/963, tsc + eslint clean. The split surface is intentionally distinct from the Scissors tool (#6) — Scissors inserts a node on the canvas at a clicked segment; Split is a path-level operation that requires an explicit node anchor from the right panel. Merge depends on multi-path selection added in #188. Try: select 2+ paths in the Path List, click 'Merge N Paths' — the right panel confirms a single new path with concatenated nodes in design order. Or: select one path + one node, click 'Split Path' — the path cuts at that node into head + tail with both inheriting the source's color/density/stitchType.
Mark closed this issue 2026-10-04 02:43:08 +00:00
Sign in to join this conversation.
No description provided.