fix: 保存车行道左右边界编辑状态

This commit is contained in:
que01 committed 2026-09-10 15:33:52 +08:00
1 parent f1a5b284a7
commit 44fa82299b
3 files changed
+59 -9

No files matched your search

+16 -7
View File
@@ -1005,7 +1005,11 @@ function solveConstraints(model, constraints, junctionData, diagnostics, cluster
? clusterEdgeOffsets
: clusterCutbacks;
if (!target.has(item.clusterId)) target.set(item.clusterId, new Map());
target.get(item.clusterId).set(item.key, value);
if (constraint.kind === 'cluster-carriageway-edge-offset' && constraint.anchor.side) {
const previous = target.get(item.clusterId).get(item.key) || { leftOffsetMeters: 0, rightOffsetMeters: 0 };
const field = `${constraint.anchor.side}OffsetMeters`;
target.get(item.clusterId).set(item.key, { ...previous, [field]: value[field] });
} else target.get(item.clusterId).set(item.key, value);
applied = true;
}
} else if (constraint.kind === 'cluster-corner-radius') {
@@ -1621,12 +1625,17 @@ function makeClusterCarriagewayHandles(model, junctionData, constraints, cluster
editable: true,
});
}
const edgeConstraint = constraintFor(constraints, 'cluster-carriageway-edge-offset', {
clusterId,
carriagewayKey: item.key,
});
const edgeValue = edgeConstraint?.value || {};
for (const side of ['left', 'right']) {
const candidates = constraints.filter(
(edit) =>
edit.enabled !== false &&
edit.kind === 'cluster-carriageway-edge-offset' &&
edit.anchor.clusterId === clusterId &&
edit.anchor.carriagewayKey === item.key &&
(!edit.anchor.side || edit.anchor.side === side),
);
const edgeConstraint = candidates.at(-1);
const edgeValue = edgeConstraint?.value || {};
handles.push({
handleId: `handle:cluster-carriageway-edge-offset:${side}:${item.key}`,
kind: 'cluster-carriageway-edge-offset',
@@ -1641,7 +1650,7 @@ function makeClusterCarriagewayHandles(model, junctionData, constraints, cluster
position: point,
axisAzimuth: (tangentAzimuth(line, station) + (side === 'left' ? 270 : 90)) % 360,
value: { current: Number(edgeValue[`${side}OffsetMeters`]) || 0, min: -10, max: 10, unit: 'meter' },
...(edgeConstraint ? { constraintId: edgeConstraint.id } : {}),
...(edgeConstraint?.anchor.side === side ? { constraintId: edgeConstraint.id } : {}),
affects: [`complex-junction:${clusterId}:carriageway:${item.approach.segmentId}`],
editable: true,
});