Editor's Path Properties has a position display but no 'x, y' input for the path — user wanting to nudge a path by exact mm has to drag, no input field #353

Closed
opened 2026-10-04 03:56:29 +00:00 by Mark · 1 comment
Owner

Finding

The Path Properties section has stitch type, density, color. It may or may not show the path's (x, y) position. Let me check.

grep -rn 'path.*x.*y\|onUpdatePathPosition' src/components/editor/EditorRightPanel.tsx returns 0.

A user with a path:

  • Wants to nudge it by exactly 2.5 mm to the right
  • Has to drag
  • Hard to get exact precision

The fix is an (x, y) input in the Path Properties section.

Where

  • Path Properties: src/components/editor/EditorRightPanel.tsx
  • No position input: grep -rn 'onUpdatePathPosition' src/components/editor/ returns 0

Suggested fix shape

  1. UI: two number inputs for x and y of the path's bounding box top-left (or centroid):
<div className="flex items-center gap-2">
  <label>X</label>
  <input
    type="number"
    step="0.1"
    value={p.x.toFixed(2)}
    onChange={(e) => onUpdatePathPosition(p.id, Number(e.target.value), p.y)}
    className="w-16 px-2 py-1 border rounded text-[11px]"
  />
  <label>Y</label>
  <input
    type="number"
    step="0.1"
    value={p.y.toFixed(2)}
    onChange={(e) => onUpdatePathPosition(p.id, p.x, Number(e.target.value))}
    className="w-16 px-2 py-1 border rounded text-[11px]"
  />
</div>
  1. Behavior: the path's bounding box is moved to the new (x, y). The path's nodes are translated by the delta.

  2. History: each input change is a single undoable action (per #243 — debounce on Enter, not on every keystroke).

  3. Use cases:

  • Precise positioning
  • Aligning multiple paths to a coordinate
  • Matching a reference image

Severity

Low. The user can drag. Power users with precise needs notice.

Discovered by

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

  • #311 (open) — Node input. Same input pattern; the node is the deeper level.
  • #352 (open) — Rotate input. Same input family.
  • Figma/Illustrator have position inputs. Standard.
## Finding The Path Properties section has stitch type, density, color. It may or may not show the path's (x, y) position. Let me check. `grep -rn 'path.*x.*y\|onUpdatePathPosition' src/components/editor/EditorRightPanel.tsx` returns 0. A user with a path: - Wants to nudge it by exactly 2.5 mm to the right - Has to drag - Hard to get exact precision The fix is an (x, y) input in the Path Properties section. ## Where - Path Properties: `src/components/editor/EditorRightPanel.tsx` - No position input: `grep -rn 'onUpdatePathPosition' src/components/editor/` returns 0 ## Suggested fix shape 1. **UI**: two number inputs for x and y of the path's bounding box top-left (or centroid): ```tsx <div className="flex items-center gap-2"> <label>X</label> <input type="number" step="0.1" value={p.x.toFixed(2)} onChange={(e) => onUpdatePathPosition(p.id, Number(e.target.value), p.y)} className="w-16 px-2 py-1 border rounded text-[11px]" /> <label>Y</label> <input type="number" step="0.1" value={p.y.toFixed(2)} onChange={(e) => onUpdatePathPosition(p.id, p.x, Number(e.target.value))} className="w-16 px-2 py-1 border rounded text-[11px]" /> </div> ``` 2. **Behavior**: the path's bounding box is moved to the new (x, y). The path's nodes are translated by the delta. 3. **History**: each input change is a single undoable action (per #243 — debounce on Enter, not on every keystroke). 4. **Use cases**: - Precise positioning - Aligning multiple paths to a coordinate - Matching a reference image ## Severity Low. The user can drag. Power users with precise needs notice. ## Discovered by Gap analysis (2026-10-02) of editor path properties. ## Related - #311 (open) — Node input. Same input pattern; the node is the deeper level. - #352 (open) — Rotate input. Same input family. - Figma/Illustrator have position inputs. Standard.
Author
Owner

feat(#353) landed on origin/main as commit d99fe73 — precise (X, Y) position input in the Path Properties Transform section (sits directly below the #352 Rotation input). The path's bounding-box centroid moves to the typed coordinate on each change; Figma / Illustrator / Inkscape convention.

  • src/components/editor/geometry.ts — new translateNodes + applyPathTranslation (NaN/Infinity clamp, identity short-circuit, bbox-centroid target math).
  • src/pages/Editor.tsx — new handleTranslateSelectedPath with the same single-commit history contract as #352 (one pushHistory entry per apply, underlay rides along, multi-select fans out).
  • src/components/editor/EditorRightPanel.tsx — two NumberField inputs (step 0.1mm, no min/max) inside the Transform section, hidden when onTranslateSelectedPath isn't wired (back-compat), disabled when the selected path has zero nodes.
  • src/components/editor/geometry.test.ts — 12 new tests pin the modulo-NaN + identity + bbox-centroid math.
  • src/components/editor/issue-353.test.tsx — 8 new panel tests pin presence, value tracking, X-only / Y-only handler dispatch, negative targets, empty/dash guards, optional-prop back-compat, empty-nodes disabled, and regression guards for the buttons + rotation input.

Local: 8/8 issue-353 tests pass, 144/144 geometry tests pass (was 132), tsc -b clean, vite build clean, eslint . clean. 20 pre-existing test failures in #329/#331/#333/#334 overlay tests are unrelated (verified by reproducing on parent main).

feat(#353) landed on origin/main as commit d99fe73 — precise (X, Y) position input in the Path Properties Transform section (sits directly below the #352 Rotation input). The path's bounding-box centroid moves to the typed coordinate on each change; Figma / Illustrator / Inkscape convention. - `src/components/editor/geometry.ts` — new `translateNodes` + `applyPathTranslation` (NaN/Infinity clamp, identity short-circuit, bbox-centroid target math). - `src/pages/Editor.tsx` — new `handleTranslateSelectedPath` with the same single-commit history contract as #352 (one pushHistory entry per apply, underlay rides along, multi-select fans out). - `src/components/editor/EditorRightPanel.tsx` — two NumberField inputs (step 0.1mm, no min/max) inside the Transform section, hidden when `onTranslateSelectedPath` isn't wired (back-compat), disabled when the selected path has zero nodes. - `src/components/editor/geometry.test.ts` — 12 new tests pin the modulo-NaN + identity + bbox-centroid math. - `src/components/editor/issue-353.test.tsx` — 8 new panel tests pin presence, value tracking, X-only / Y-only handler dispatch, negative targets, empty/dash guards, optional-prop back-compat, empty-nodes disabled, and regression guards for the buttons + rotation input. Local: 8/8 issue-353 tests pass, 144/144 geometry tests pass (was 132), `tsc -b` clean, `vite build` clean, `eslint .` clean. 20 pre-existing test failures in #329/#331/#333/#334 overlay tests are unrelated (verified by reproducing on parent main).
Mark closed this issue 2026-10-05 11:58:23 +00:00
Sign in to join this conversation.
No description provided.