feat: drag lane turn arrows along their lanes

This commit is contained in:
que01 committed 2026-09-01 10:24:59 +08:00
1 parent 5457f960ff
commit 9cb715a592
12 files changed
+335 -24

No files matched your search

@@ -0,0 +1,2 @@
{"file": ".trellis/spec/frontend/direct-edit-client.md", "reason": "Check no baseline writes, per-pointermove React churn, or accidental rotation path."}
{"file": ".trellis/spec/guides/cross-layer-thinking-guide.md", "reason": "Check position serialization, validation, and recompile behavior across layers."}
@@ -0,0 +1,28 @@
# Design: Lane Maneuver Position Drag
## Selection And Gesture
The selected arrow group remains one logical target: `lane_id + maneuver`. A new
display-only selection layer will become the drag hit target, while its members are
never moved independently. Pointer coordinates are projected onto the lane centerline
and converted to a distance from the lane's junction end, matching the compiler's
`placement_distance_meters` convention.
## Contract
The existing `lane-maneuver` override gains optional finite, non-negative
`placementDistanceMeters`, measured from the lane's junction end. The compiler uses
it when present, otherwise keeps its current candidate-placement algorithm
byte-for-byte. Maneuver and position are updated together by lane id so an old
maneuver override cannot shadow a newer position entry.
## Validation And Preview
The server remains authoritative for collision checks and final geometry. The client
may project and clamp the ghost for responsive feedback, but it must submit the
position through the existing save/recompile boundary and never mutate baseline
GeoJSON. The candidate position must clear control features and leave the compiler's
endpoint safety buffer.
Rotation is intentionally absent from the contract; adding it later must not require
reinterpretation of the position field.
@@ -0,0 +1,2 @@
{"file": ".trellis/spec/frontend/direct-edit-client.md", "reason": "Reuse the existing projection, ghost, baseline ownership, and save-boundary rules for a new lane-arrow gesture."}
{"file": ".trellis/spec/guides/cross-layer-thinking-guide.md", "reason": "Trace the new position field from UI through override validation and compiler placement."}
@@ -0,0 +1,14 @@
# Implementation Plan
1. Resolve invalid-position behavior and freeze the wire field name/units in the PRD.
2. Add compiler validation and placement override handling with empty-override parity tests.
3. Add a lane-arrow drag interaction that projects along the lane and moves the complete part group.
4. Add authoritative save/recompile wiring and focused client/server regression tests.
5. Run format, server tests, client type/unit tests, and production build; manually verify
an existing and a newly-added arrow in the workbench.
## Explicit Non-Goals
- Arrow rotation or arbitrary lateral movement.
- Position editing for `native-road-direction-arrow/v1`.
- Per-part dragging or a second undo/preview protocol.
@@ -0,0 +1,59 @@
# 车道转向箭头位置拖曳
## Goal
TBD.
## Requirements
- TBD
## Acceptance Criteria
- [ ] TBD
## Notes
- Keep `prd.md` focused on requirements, constraints, and acceptance criteria.
- Lightweight tasks can remain PRD-only.
- For complex tasks, add `design.md` for technical design and `implement.md` for execution planning before `task.py start`.
# 车道转向箭头位置拖曳
## 目标
让用户可以把一个完整的路口转向箭头沿所属车道拖到新的位置。箭头的 polygon
part 必须整体平移,内部形状、part 顺序和 `maneuver` 不变;旋转和箭头内容修改
不属于本任务。
## 已确认事实
- 一个视觉箭头由同一 `lane_id + maneuver` 下的 3 或 5 个 polygon part 组成,点击
任一 part 已能选中整组。
- 编译器目前以 `placement_distance_meters` 记录箭头距路口端的距离,并在 6/10/14/18/22m
候选位置中避开斑马线和停止线。该字段目前是输出值,还没有 override 合同。
- 车道中心线已作为无箭头车道的选择入口;位置拖曳必须同时适用于已有箭头和刚新增的箭头。
- 现有 v2 拖曳链路按车道轴投影、以服务端预览为准;箭头位置属于新的离散/连续混合
override,不能伪装成道路宽度或路口偏移 constraint。
## 范围
1. 拖曳完整 `lane_id + maneuver` 箭头组,保持 part 相对几何不变。
2. 将拖曳位置保存为 `lane-maneuver.placementDistanceMeters`(从车道驶入路口端量起的米数),
并在保存/重新生成后由编译器读取。
3. 位置必须沿车道中心线投影,不能改变横向位置;不能越过车道有效端点或与斑马线、停止线重叠。
4. 已有的 maneuver 下拉框继续有效;旋转手柄、角度字段和沿路 `directionArrows` 不在范围内。
## 验收标准
- [ ] 拖曳任一箭头 part 会整体移动同组所有 part,不拆散、不改变形状和旋转。
- [ ] 拖曳释放时位置按车道轴投影并受有效范围约束;服务端正式编译输出的
`placement_distance_meters` 反映新位置。
- [ ] 新增箭头后也能拖曳其位置;刷新或重新编译不会回到旧位置。
- [ ] 箭头不能落在斑马线/停止线范围内,也不能超出车道安全端点。
- [ ] 未设置位置覆盖时,输出与现有编译结果字节一致。
- [ ] 旋转、沿路重复方向箭头和既有 v2 控件行为不回归。
## 关键决策
当用户把箭头拖向无效区域(控制设施或安全端点)时,连续夹紧到最近合法位置,
并在拖动过程中让完整箭头组停在该位置。这个行为与现有 v2 数值拖曳一致。
@@ -0,0 +1,26 @@
{
"id": "lane-maneuver-position-drag",
"name": "lane-maneuver-position-drag",
"title": "车道转向箭头位置拖曳",
"description": "",
"status": "in_progress",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "dingkang",
"assignee": "dingkang",
"createdAt": "2026-09-01",
"completedAt": null,
"branch": null,
"base_branch": "main",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}