Editor's Path Properties section has 'Path length' but the 'per-node distance' is not visible — user wanting to know the length of each segment (e.g., 'node 4 to 5 is 12mm') has to compute from the (x, y) values #370

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

Finding

grep -rn 'segmentLength\|segmentLengths' src/components/editor/ returns 0. The Path Properties doesn't show the length of each segment.

A user with a 10-node path:

  • Total length: 100mm
  • Wants to know "which segment is the longest?"
  • Has to compute (delta x)² + (delta y)² for each segment

The fix is to show the segment lengths (e.g., on hover of a node, or in a tooltip on the segment).

Where

  • Path Properties: src/components/editor/EditorRightPanel.tsx
  • No segment length: grep -rn 'segmentLength' src/components/editor/ returns 0
  • The geometry: src/components/editor/geometry.ts (the algorithm is trivial: distance between consecutive nodes)

Suggested fix shape

  1. Tooltip on hover: when the user hovers a node, show a tooltip with the segment lengths:
<Tooltip>
  <TooltipTrigger>{nodeIndex + 1}</TooltipTrigger>
  <TooltipContent>
    Node {nodeIndex + 1} of {nodes.length}
    <br />
    In: {(segmentLengths[nodeIndex - 1] ?? 0).toFixed(2)} mm
    <br />
    Out: {(segmentLengths[nodeIndex] ?? 0).toFixed(2)} mm
  </TooltipContent>
</Tooltip>
  1. Highlight longest segment: the segment with the maximum length is drawn in a different color.

  2. Statistics: a "Longest: 12 mm, Average: 5 mm" summary.

  3. Use cases:

  • The user wants to find the longest segment (for "is this path too long?")
  • The user is debugging a specific node

Severity**

Low. The user can compute. Power users with complex paths notice.

Discovered by

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

  • The geometry module's pathLength is the source.
  • #305 (open) — Show coordinates. Same node; the coords are the position.
  • Figma/Illustrator have segment info on hover. Standard.
## Finding `grep -rn 'segmentLength\|segmentLengths' src/components/editor/` returns 0. The Path Properties doesn't show the length of each segment. A user with a 10-node path: - Total length: 100mm - Wants to know "which segment is the longest?" - Has to compute (delta x)² + (delta y)² for each segment The fix is to show the segment lengths (e.g., on hover of a node, or in a tooltip on the segment). ## Where - Path Properties: `src/components/editor/EditorRightPanel.tsx` - No segment length: `grep -rn 'segmentLength' src/components/editor/` returns 0 - The geometry: `src/components/editor/geometry.ts` (the algorithm is trivial: distance between consecutive nodes) ## Suggested fix shape 1. **Tooltip on hover**: when the user hovers a node, show a tooltip with the segment lengths: ```tsx <Tooltip> <TooltipTrigger>{nodeIndex + 1}</TooltipTrigger> <TooltipContent> Node {nodeIndex + 1} of {nodes.length} <br /> In: {(segmentLengths[nodeIndex - 1] ?? 0).toFixed(2)} mm <br /> Out: {(segmentLengths[nodeIndex] ?? 0).toFixed(2)} mm </TooltipContent> </Tooltip> ``` 2. **Highlight longest segment**: the segment with the maximum length is drawn in a different color. 3. **Statistics**: a "Longest: 12 mm, Average: 5 mm" summary. 4. **Use cases**: - The user wants to find the longest segment (for "is this path too long?") - The user is debugging a specific node ## Severity** Low. The user can compute. Power users with complex paths notice. ## Discovered by Gap analysis (2026-10-02) of editor path properties. ## Related - The geometry module's `pathLength` is the source. - #305 (open) — Show coordinates. Same node; the coords are the position. - Figma/Illustrator have segment info on hover. Standard.
Author
Owner

Closed by commit aeadc39 on main.

Adds a Longest segment row to Path Info (sits right under the existing Path Length row) showing the longest individual edge plus the average, so the user can spot segment imbalances without computing (delta-x)^2 + (delta-y)^2 by hand. The Node N of M Selected Nodes hint gets an inline in X / out Y mm suffix for a single selected node so the user can see both adjacent edges at a glance.

The new segmentLengthsMm helper lives next to estimatePathLength in EditorRightPanel.tsx; both the Path Info row and the per-node hint read from it so the numbers stay consistent. Closed paths get an implicit closing edge (n segments for closed vs n-1 for open) so the values add up to the existing Perimeter row.

Closed by commit [aeadc39](https://forgejo.tail018ac4.ts.net/Mark/Kimi_Agent_Brother_10_Digitizing_App/commit/aeadc39) on main. Adds a `Longest segment` row to Path Info (sits right under the existing Path Length row) showing the longest individual edge plus the average, so the user can spot segment imbalances without computing (delta-x)^2 + (delta-y)^2 by hand. The `Node N of M` Selected Nodes hint gets an inline `in X / out Y mm` suffix for a single selected node so the user can see both adjacent edges at a glance. The new `segmentLengthsMm` helper lives next to `estimatePathLength` in `EditorRightPanel.tsx`; both the Path Info row and the per-node hint read from it so the numbers stay consistent. Closed paths get an implicit closing edge (n segments for closed vs n-1 for open) so the values add up to the existing Perimeter row.
Mark closed this issue 2026-10-05 15:23:35 +00:00
Sign in to join this conversation.
No description provided.