Copy/paste keeps the source arc's centre and silently drops biarcs #97

Open
opened 2026-10-13 02:28:37 +00:00 by ImBenji · 0 comments
Owner

From the engineering review on 2026-10-13.

_withStartEnd (called at lib/provider/map_data_state.dart:3543) shifts an arc's start and end but not ArcSegment.center, and resolveGeometry() trusts the stored centre. The pasted arc gets the wrong sweep direction and exit tangent, and that geometry feeds the renderer, hit testing, station attach and export bounds. Separately, the clipboard payload (around line 3147) only takes non-biarc segments, so biarcs are dropped with no feedback.

Also in the paste path: the replacement MetroLine built when a line id clashes omits padding (around line 3501) and _metroLinesEqual ignores it, so the pasted line gets default padding.

Evidence: test/review_probes/engine_model_ops_probe.dart (local, untracked): pasted arc start=(500,300) end=(520,320) center=(0,20), clockwise=false where the source is clockwise=true; copied segments: 1 of 2 selected; pasted line padding=5.0 (source 9.0). Model level only, the on-screen result was not checked.

Fix sketch: translate the centre when both ends move by the same delta (the move path already does this around line 2520), include biarcs in the snapshot, and build the pasted line with copyWith.

From the engineering review on 2026-10-13. `_withStartEnd` (called at `lib/provider/map_data_state.dart:3543`) shifts an arc's start and end but not `ArcSegment.center`, and `resolveGeometry()` trusts the stored centre. The pasted arc gets the wrong sweep direction and exit tangent, and that geometry feeds the renderer, hit testing, station attach and export bounds. Separately, the clipboard payload (around line 3147) only takes non-biarc segments, so biarcs are dropped with no feedback. Also in the paste path: the replacement `MetroLine` built when a line id clashes omits `padding` (around line 3501) and `_metroLinesEqual` ignores it, so the pasted line gets default padding. **Evidence:** `test/review_probes/engine_model_ops_probe.dart` (local, untracked): `pasted arc start=(500,300) end=(520,320) center=(0,20)`, `clockwise=false` where the source is `clockwise=true`; `copied segments: 1 of 2 selected`; pasted line `padding=5.0 (source 9.0)`. Model level only, the on-screen result was not checked. **Fix sketch:** translate the centre when both ends move by the same delta (the move path already does this around line 2520), include biarcs in the snapshot, and build the pasted line with `copyWith`.
ImBenji added the bug label 2026-10-13 02:28:37 +00:00
ImBenji added this to the Arcs & Angles project 2026-10-13 02:28:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#97