chore(task): re-plan the crosswalk experiment around one root cause
Three symptoms turned out to be one hole. junctionAffects() builds junctionSurface + roadAffects + connectors and never adds crosswalks, so on an area with 48 of them the crosswalk-inset handle reports 59 affected features and zero crosswalks. The cause is that stripe ids key off the crossing node while the solver has no approach-to-group mapping — which is also why there is no stable elementId and why clicking a stripe cannot select the group. Publishing that mapping resolves all three, so it is now the first gate rather than three separate steps. Corner resize moves into the first phase by decision; rotation is deferred, since it needs a new constraint kind and the compiler has to consume it before any grip may be drawn. Sizing semantics are settled: stripe depth is a stored number, but span is count x pitch, so the corner drag varies the count at a fixed 0.9m pitch and therefore quantises. That is honest rather than janky and the UI has to read as deliberate snapping. It also fixes span being pinned at 5.4m regardless of road width, which will move fixture baselines. Records the data prerequisite: crossing nodes are required, and the current import had none, which is what made the handle look broken. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2ef24539f9
commit
086939be93
3 files changed
+147
-26
No files matched your search
@@ -37,7 +37,28 @@ interface EditableElement {
|
||||
}
|
||||
```
|
||||
|
||||
第一阶段只发布 `position` 及其现有 `junction-crosswalk-inset` 回写规则。第二阶段再加入尺寸和条带参数,避免在实验开始前规定尚未验证的通用元素协议。
|
||||
第一阶段发布 `position` 与 `length` / `width`:位置沿用现有 `junction-crosswalk-inset`,尺寸需要新的回写规则(见「尺寸的语义」)。`rotation` **不在本任务范围**,理由见文末。
|
||||
|
||||
## `affects` 与 `elementId` 是同一个洞
|
||||
|
||||
`junctionAffects()`(`direct-edit-solver.js:628`)构造的是
|
||||
`junctionSurfaceId + roadAffects + connectors`,**从不加入 crosswalk 或 stop-line**。
|
||||
实测在有 48 条斑马线的区域,`junction-crosswalk-inset` 手柄的 `affects` 共 59 项,
|
||||
其中 crosswalk **为 0**。
|
||||
|
||||
成因是同一个:斑马线 feature id 用的是 `crosswalk:node/<crossing 节点>:<序号>`,
|
||||
而求解器手上没有「进口 → 斑马线组」的映射。那个关系只存在于编译器的
|
||||
`compileControlMarkings()` 内部,从未对外发布。
|
||||
|
||||
因此下面三件事是一次工作,不是三次:
|
||||
|
||||
| 症状 | 需要的东西 |
|
||||
| --- | --- |
|
||||
| `affects` 不含斑马线,拖拽高亮会亮错 | 进口 ↔ 斑马线组映射 |
|
||||
| 没有稳定 `elementId` | 同上 |
|
||||
| 点条带无法选中整组 | 同上 |
|
||||
|
||||
补上映射并随 manifest 发布,三者一起解决。这也是第一阶段的第一个门禁。
|
||||
|
||||
## 编辑与预览
|
||||
|
||||
@@ -46,9 +67,67 @@ interface EditableElement {
|
||||
- 选中框和控件只是 `editHandles` / `editGhost` 层的临时 UI;权威预览仍由服务端返回,baseline source 不被客户端改写。
|
||||
- 空白点击会清除元素选择;道路选择可继续决定道路级 handle manifest。斑马线元素选中与道路选择可并存,但两组控件不得重叠或竞争同一 pointer 手势。
|
||||
|
||||
## 尺寸的语义
|
||||
|
||||
斑马线的几何目前**全是字面量**(`native-road.js:1264`):
|
||||
|
||||
```js
|
||||
rectangleAt(controlCenter, axis, across, 3, 0.45, -2.25 + index * 0.9)
|
||||
// ↑长 ↑宽 ↑偏移,共 6 条
|
||||
```
|
||||
|
||||
`rectangleAt(center, axis, across, length, width, offset)` 中 `length` 沿 `axis`
|
||||
(行车方向),`width` 沿 `across`(横跨道路)。所以:
|
||||
|
||||
| 用户看到的 | 实际是什么 | 存储形态 |
|
||||
| --- | --- | --- |
|
||||
| 进深(沿行车方向) | 每条条带的 `length`,6 条共用 | 一个数,可直接参数化 |
|
||||
| 跨度(横跨道路) | **条带数 × 间距**,非存储值 | 派生量 |
|
||||
|
||||
跨度是派生量,所以拖四角改跨度必须决定改哪个因子。**已定:固定间距、改条带数。**
|
||||
|
||||
- 条带宽 0.45m 与间隙 0.45m(间距 0.9m)在现实中是标准化的,改间距会让宽路上的
|
||||
斑马线拉得很稀,不符合任何规范。
|
||||
- 代价是跨度手柄按 0.9m **量化跳动**,不是连续的。这是语义诚实的结果,
|
||||
不是手感缺陷;UI 上必须让它看起来是有意吸附的。
|
||||
|
||||
同时修掉一个既有缺陷:**跨度恒为 5.4m,与路宽无关**。20m 宽的路上斑马线也只有
|
||||
5.4m,横不过去。参数化后默认跨度应由路宽推导,而不是写死 6 条。
|
||||
|
||||
## 选中框与抓手
|
||||
|
||||
视觉采用常规 transform gizmo:矩形虚线选框 + 四角空心方块。
|
||||
|
||||
一条硬规矩:**画几个抓手,就得有几个是活的。** 画了拖不动的四角、或转了没反应的
|
||||
旋转柄,正是 `flag.ts` 为 `profile.interval` 立下的反面教材——
|
||||
「一个拖了没效果的控件比没有控件更糟」。长得像 Figma 但只有一半能用,
|
||||
比朴素的圆点更糟,用户会当成 bug 报。
|
||||
|
||||
所以抓手随能力分批出现,而不是先画全再逐个点亮:
|
||||
|
||||
| 抓手 | 语义 | 何时出现 |
|
||||
| --- | --- | --- |
|
||||
| 虚线选框 | 纯反馈,无语义 | 第一阶段 |
|
||||
| 移动 | `junction-crosswalk-inset` | 第一阶段(语义现成) |
|
||||
| 四角方块 | 进深 / 跨度 | 第一阶段(需编译器参数化) |
|
||||
| 旋转柄 | 相对进口轴的偏转角 | **不做** |
|
||||
|
||||
## 旋转为何押后
|
||||
|
||||
`axis` 派生自 `crosswalkCandidate.placement.axis`,即进口方向。要能旋转,
|
||||
需要新增一个「相对进口轴的偏转角」constraint kind。而 `design.md` 的规矩是
|
||||
**新增 kind 的前提是几何阶段必须已经消费它**——先证明 `compileGeometry()` 读取
|
||||
该参数,再画任何手柄。
|
||||
|
||||
偏转角本身是合理的(现实中斑马线确实会相对进口斜置),且用「相对派生轴的角度」
|
||||
表达是语义化的,不违反「不持久化 transform 矩阵」。但它是独立的一轮
|
||||
编译器 + kind + 客户端工作,已明确押后。
|
||||
|
||||
## 数据演进
|
||||
|
||||
第一阶段不新增 persisted schema:位置继续使用已有 `junction-crosswalk-inset`。第二阶段如果确实需要尺寸参数,新增一个专属 kind 或扩展同一 kind 的严格 schema 校验;具体选择以第一阶段运行结果为准,不预先固化。
|
||||
位置继续使用已有 `junction-crosswalk-inset`。尺寸需要新的持久化形态,本阶段一并落地:进深与条带数各是一个参数,跨度由 `条带数 × 间距` 派生,间距本阶段不可编辑。具体是新增专属 kind 还是扩展同一 kind 的严格 schema,在第一个门禁(进口↔组映射)通过后定,不预先固化。
|
||||
|
||||
新增任何 kind 前必须先证明 `compileGeometry()` 读它——本项目已经为 `profile.interval` 交付过一个拖了无效果的手柄。
|
||||
|
||||
缺省参数必须字节级保持现有斑马线输出。参数越界、条带间互相重叠或越过可用进口范围均返回 blocking diagnostic,不在客户端静默钳制真实约束。
|
||||
|
||||
|
||||
Reference in new issue
Block a user