drawStyledLine is a local closure, so the line rendering rule cannot be followed #103

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

From the engineering review on 2026-10-13.

The project rule says all line drawing goes through drawStyledLine in lines_v2.dart. But drawStyledLine is a local closure inside _drawLinesV2 (lib/rendering/components/lines_v2.dart:567), so nothing outside that function can call it.

The result is three inline copies of "resolve arc or biarc, build a Path, stroke with ad-hoc paints" for selection and hover rings: lib/rendering/components/highlights.dart (around lines 22 to 110) and lib/rendering/components/selection_v2.dart (around 455 to 530 and 805 to 880). They ignore corner fillet trimming and always use round caps, so a ring on a flat-capped end will not match the line. Overlay only, never exported.

Related debt in the same file: _drawStyledPath (lines 40 to 162) is a second full copy of the style table, with different caps, and the road and dashed dash loops exist four times.

Doc fix to go with it: CLAUDE.md calls lines.dart "the older pass", but it owns _drawSegmentsForLine, the only geometry pass, which lines_v2.dart calls 12 times. Deleting it as legacy would break all line rendering.

Status: confirmed by reading.

Fix sketch: lift drawStyledLine to an extension method and have the rings go through _drawSegmentsForLine(customPath:).

From the engineering review on 2026-10-13. The project rule says all line drawing goes through `drawStyledLine` in `lines_v2.dart`. But `drawStyledLine` is a local closure inside `_drawLinesV2` (`lib/rendering/components/lines_v2.dart:567`), so nothing outside that function can call it. The result is three inline copies of "resolve arc or biarc, build a `Path`, stroke with ad-hoc paints" for selection and hover rings: `lib/rendering/components/highlights.dart` (around lines 22 to 110) and `lib/rendering/components/selection_v2.dart` (around 455 to 530 and 805 to 880). They ignore corner fillet trimming and always use round caps, so a ring on a flat-capped end will not match the line. Overlay only, never exported. Related debt in the same file: `_drawStyledPath` (lines 40 to 162) is a second full copy of the style table, with different caps, and the road and dashed dash loops exist four times. Doc fix to go with it: `CLAUDE.md` calls `lines.dart` "the older pass", but it owns `_drawSegmentsForLine`, the only geometry pass, which `lines_v2.dart` calls 12 times. Deleting it as legacy would break all line rendering. **Status:** confirmed by reading. **Fix sketch:** lift `drawStyledLine` to an extension method and have the rings go through `_drawSegmentsForLine(customPath:)`.
ImBenji added the enhancementarea:rendering labels 2026-10-13 02:28:57 +00:00
ImBenji added this to the Arcs & Angles project 2026-10-13 02:28:57 +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#103