feat: edit lane turn arrows in workbench
This commit is contained in:
1 parent
8b84166e6f
commit
e48eb15827
9 files changed
+330
-28
No files matched your search
@@ -140,6 +140,19 @@ match `main` exactly. Guard once at construction, not per call site.
|
||||
while `compileGeometry()` ignores `profile.interval`. A control whose drag changes
|
||||
nothing is worse than no control.
|
||||
|
||||
### V1 override selection is not direct edit
|
||||
|
||||
`lane-maneuver` is a saved v1 override for a discrete lane attribute, not a spatial
|
||||
constraint. Its click selection and inspector selector are intentionally available
|
||||
without `directEdit`: they stage `{ kind: 'lane-maneuver', laneId, maneuver }` and
|
||||
wait for the existing save/recompile path. Do not route them through `EditSession`,
|
||||
the preview endpoint, or a draggable element outline.
|
||||
|
||||
The distinction is observable: the ordinary workbench may select a turn-arrow part
|
||||
or lane centerline and show this selector, while the `directEdit` flag still means
|
||||
there are no edit sources, manifest requests, handles, ghosts, previews, or control
|
||||
marking outlines.
|
||||
|
||||
---
|
||||
|
||||
## 10. Saving is not the same as applying
|
||||
@@ -243,4 +256,3 @@ one. `handle.constraintId` — present only when a constraint exists — is also
|
||||
- [ ] Every input channel meets at the shared exits, not a parallel path
|
||||
- [ ] Displayed bounds round inward, so an offered extreme is accepted
|
||||
- [ ] A focused field is not rewritten by an arriving preview
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
|
||||
{"file": ".trellis/spec/frontend/direct-edit-client.md", "reason": "Verify that new lane selection does not write baseline layers or join the drag-handle path."}
|
||||
{"file": ".trellis/spec/guides/cross-layer-thinking-guide.md", "reason": "Verify the staged override remains a compiler-valid lane-maneuver payload."}
|
||||
@@ -0,0 +1,48 @@
|
||||
# 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.
|
||||
@@ -1 +1,2 @@
|
||||
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
|
||||
{"file": ".trellis/spec/frontend/direct-edit-client.md", "reason": "Preserve direct-edit layer and handle ownership while adding a separate v1 discrete selection path."}
|
||||
{"file": ".trellis/spec/guides/cross-layer-thinking-guide.md", "reason": "Keep the UI's staged override shape aligned with the compiler and API contract."}
|
||||
@@ -0,0 +1,16 @@
|
||||
# Implementation Plan
|
||||
|
||||
1. Generalize the element registry's group-key reader and add a lane-maneuver
|
||||
selection type for turn arrows and lane centerlines.
|
||||
2. Wire map clicks to preserve the existing control-element path while selecting
|
||||
lane arrows or centerlines through the new path.
|
||||
3. Add an inspector selector that stages a lane-maneuver override with canonical
|
||||
values and an explicit removal value.
|
||||
4. Add focused element tests for multi-property grouping and unmarked-lane entry.
|
||||
5. Run formatting, server tests, client type/unit tests, and production build.
|
||||
|
||||
## Rollback
|
||||
|
||||
The UI is isolated to `workbench/client/src/edit/element.ts`, `App.tsx`, and its
|
||||
unit tests. Reverting those files restores the previous display-only arrow behavior;
|
||||
the compiler's already-shipped v1 override contract remains untouched.
|
||||
@@ -84,3 +84,42 @@ v1 override 里已有覆盖 OSM 派生值的先例:`road` kind 覆盖 `laneCou
|
||||
接 UI 时需要的前置:导向箭头的分组键是 `lane_id + maneuver`(实测 108 个 → 28 组,
|
||||
每组 3 或 5 个 part),与斑马线的 `crossing_node_id` 不同形态,
|
||||
`element.ts` 的注册表需要扩展 `groupProperty` 为可组合的形式。
|
||||
|
||||
## UI 增量(规划中,2026-09-01)
|
||||
|
||||
### 已确认事实
|
||||
|
||||
- 工作台点击事件会传递所有命中的 feature,但只有开启 `?directEdit=1` 时才会请求
|
||||
`element.ts` 判断是否为可编辑元素;该注册表目前仅登记斑马线和停止线,故转向箭头
|
||||
会清空元素选择。
|
||||
- 路口转向箭头的 provenance 是 `native-road-turn-arrow/v1`,一个逻辑箭头由
|
||||
`lane_id + maneuver` 共同标识,并绘制为 3 或 5 个 part。
|
||||
- `lane-maneuver` 是 v1 离散 override,不是 v2 位置约束;它不能接入现有
|
||||
`ElementSelection -> handleForElement -> 拖拽手柄` 路径。
|
||||
- 沿车道重复的道路方向箭头 provenance 是 `native-road-direction-arrow/v1`,固定为
|
||||
`through`,由 32m 间距规则生成,当前没有对应的 override 合同。
|
||||
- 仅允许点击已生成的转向箭头无法满足“给 OSM 未标注车道新增箭头”:该车道没有 feature
|
||||
可点,故 UI 还必须允许从车道中心线或道路检查器选择目标车道。
|
||||
|
||||
### 拟议范围
|
||||
|
||||
1. 点击任一转向箭头 part 时,选中其完整 `lane_id + maneuver` 组,并在检查器展示
|
||||
六种合法转向及“无箭头”。
|
||||
2. 从车道中心线进入同一编辑器,使没有现存转向箭头的车道也能新增箭头。
|
||||
3. 选择值以单一、按 `laneId` upsert 的 `lane-maneuver` override 暂存;保存并重新生成后
|
||||
更新正式几何。空字符串仍表示移除。
|
||||
4. 扩展 element 注册表的分组键表达能力,但不把 v1 override 伪装成 v2 拖拽约束。
|
||||
|
||||
### 验收标准(UI)
|
||||
|
||||
- [x] 点击任一 `native-road-turn-arrow/v1` part 会选中同一
|
||||
`lane_id + maneuver` 的所有 part,且不会并入同车道的其他 maneuver。
|
||||
- [x] 点击车道中心线能选中该车道并展示相同的转向编辑器;即使该车道当前没有转向箭头,
|
||||
用户仍能选择一种转向并暂存。
|
||||
- [x] 转向编辑器只提供编译器接受的六种规范值和“无箭头”;选择会按 laneId upsert
|
||||
一个 `lane-maneuver` override,空字符串表示移除。
|
||||
- [x] “保存修改”后 override 被服务端接受;“保存并重新生成”后,编译结果反映所选
|
||||
maneuver 或移除,并可重新选择新的箭头。
|
||||
- [x] `native-road-direction-arrow/v1` 不显示转向编辑器,32m 间距及其生成数量不变。
|
||||
- [x] 既有斑马线、停止线选择及直接编辑手柄不回归;`npm run format:check`、
|
||||
`npm run test`、`npm run test:client`、`npm run test:client:unit`、`npm run build` 通过。
|
||||
Reference in new issue
Block a user