Files

49 lines
2.5 KiB
Markdown

# Lane Maneuver UI Design
## Boundary
This increment exposes the existing v1 `lane-maneuver` override in the workbench.
It changes neither compiler validation nor the placement algorithms. In particular,
`native-road-direction-arrow/v1` remains display-only because it represents repeated
straight-ahead markings controlled by a separate interval policy.
## Selection Model
`edit/element.ts` remains the sole conversion point from clicked GeoJSON properties
to a logical element. Its registry gains a turn-arrow entry whose group key is the
ordered tuple `[lane_id, maneuver]`; the key is serialized with a dedicated, stable
separator rather than inferred from `native_id`. This groups the 3/5 polygon parts
of one visual arrow without merging arrows from different maneuvers on the same lane.
The current crosswalk/stop-line `ElementSelection` is junction-control-specific.
Turn arrows instead produce a lane selection carrying `laneId`, `maneuver`, and the
group feature ids. They deliberately do not call `handleForElement` or create an
outline/drag target: changing a maneuver is a v1 discrete override rather than a
v2 spatial constraint.
Lane centerlines already publish `native_id` equal to the compiler lane id. The
click handler recognizes that id and creates the same lane selection, with the
current maneuver resolved from the stored/staged override first, then from the
clicked turn arrow if present, otherwise empty. That makes an unmarked lane editable.
## Inspector And Save Flow
The inspector owns the discrete selector. It receives the selected lane and the
effective override list, offers the compiler's six exact canonical values plus
empty-string removal, and stages one deterministic id per lane. The existing
`stage` function replaces entries with equal ids, so a lane has exactly one pending
override and save/recompile continues through the established API path.
This is intentionally not a direct-edit (`EditSession`) operation: no preview
endpoint consumes lane-maneuver and a client-side visual preview would disagree with
the authoritative compiler output. The existing save-then-recompile copy remains
the user-visible boundary.
## Tests
Pure tests cover tuple grouping, part selection, lane-centerline selection and
non-selection of direction arrows. A component-level test is unnecessary for the
existing app test style; the inspector's emitted object is kept simple enough to
exercise by extracting a pure override builder if needed. Typecheck and build cover
the wiring.