chore(road-editor): plan direct-edit task tree and add client test infra
Planning: parent design.md becomes the single authoritative contract (constraint model with 6 kinds, handle manifest, coordinate/unit layering, preview sequencing, storage layout and lazy migration, area config snapshot, API contract). Work is split into four independently verifiable child tasks with per-step gates and rollback points. Test infra: pin vitest 4.1.11, add test:client:unit for client pure logic, extend prettier globs to root *.ts so vitest.config.ts is checked. Add .gitignore: the repo had none, so inputs/, outputs/, workbench-data/ and the client build output were untracked rather than ignored. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
42
.trellis/tasks/08-26-direct-edit-map-editor/prd.md
Normal file
42
.trellis/tasks/08-26-direct-edit-map-editor/prd.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# 主地图道路区间编辑器
|
||||
|
||||
父任务:`.trellis/tasks/08-26-direct-manipulation-road-editor`。需求来源与权威合约在父任务的 `prd.md` / `design.md`。
|
||||
|
||||
## 目标
|
||||
|
||||
在主地图上实现道路内部区间的直接操纵:外缘、步行带、车道分隔与区间范围可拖,拖拽即时有 ghost,服务端返回权威预览,改动可撤销、可保存。
|
||||
|
||||
## 顺序依赖
|
||||
|
||||
前置:`direct-edit-solver-api` 的第 2 步(handle manifest)交付后即可开工;完整验收需要其预览与保存端点全部就绪。
|
||||
后继:`direct-edit-junction-tools` 复用本任务的 `EditSession`、ghost/preview 图层与命令栈。
|
||||
|
||||
## 范围
|
||||
|
||||
- `ol-ext` Transform 的限时隔离探针,以及不通过时的原生 OpenLayers 回退。
|
||||
- selection → handle manifest 的读取与渲染;handles / ghost / preview 三个独立 source。
|
||||
- 四类可拖能力:外缘偏移、步行带宽度、车道分隔位置、区间范围控制。
|
||||
- `EditSession`:命令栈、undo/redo、应用/保存/取消。
|
||||
- 80ms 防抖预览、`pointerup` 强制最终请求、`previewSeq` 乱序丢弃、`AbortController` 取消在途请求。
|
||||
- 无效草稿的诊断反馈,保留最后一个有效预览。
|
||||
- `directEdit` 开关,默认关闭。
|
||||
|
||||
## 不做
|
||||
|
||||
- 路口 reserve 内的任何编辑(属 `direct-edit-junction-tools`)。
|
||||
- 遗留 `workbench/client/app.js` 的同步或删除。
|
||||
- OSM 中心线与拓扑的编辑。
|
||||
|
||||
## 验收标准
|
||||
|
||||
- [ ] 选中道路后出现手柄,拖拽前后 OpenLayers `Map` 为同一实例,未被重建。
|
||||
- [ ] 拖动外缘 → 道路面、步行带、车道线、标线、connector 一致更新,只有受影响 source 被替换。
|
||||
- [ ] 车道分隔手柄可独立调整某条分隔线,效果不等价于外缘偏移的副作用。
|
||||
- [ ] 区间范围手柄可修改影响区间,两端平滑过渡回基线。
|
||||
- [ ] 落在 junction reserve 内的手柄不可拖动,并提示进入 `JunctionTools`。
|
||||
- [ ] 连续快速拖拽后松手,最终几何与松手位置一致,无回跳。
|
||||
- [ ] 违反不变量的草稿显示阻塞诊断,地图停在最后一个有效预览。
|
||||
- [ ] 未保存编辑可撤销/重做;保存后重新编译几何不变,约束状态 `exact`。
|
||||
- [ ] 客户端单元测试覆盖:命令栈与 undo/redo、`previewSeq` 乱序丢弃、handle 事件到约束值的投影、米制换算在不同纬度的正确性。
|
||||
- [ ] 关闭 `directEdit` 开关后,工作台行为与当前 main 一致。
|
||||
- [ ] `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