feat(junction): edit complex cutbacks and corners

This commit is contained in:
que01 committed 2026-09-08 14:30:43 +08:00
1 parent d0e1f62f2b
commit 80f122be46
15 files changed
+354 -38

No files matched your search

+15 -2
View File
@@ -266,8 +266,10 @@ function App() {
if (junctionDescriptor.ref.type === 'cluster')
return manifest.handles.filter(
(handle) =>
handle.kind === 'cluster-carriageway-width' &&
handle.anchor.type === 'cluster-carriageway' &&
(handle.kind === 'cluster-carriageway-width' ||
handle.kind === 'cluster-carriageway-cutback' ||
handle.kind === 'cluster-corner-radius') &&
'clusterId' in handle.anchor &&
handle.anchor.clusterId === junctionDescriptor.ref.id,
);
const nodeIds = new Set(junctionDescriptor.nodeIds.map(String));
@@ -486,12 +488,23 @@ function App() {
// control handles silently returned null and never scheduled a preview.
const roadId = 'roadId' in handle.anchor ? handle.anchor.roadId : null;
const sourceRoadId = handle.anchor.type === 'cluster-carriageway' ? handle.anchor.sourceRoadIds[0] : null;
const cornerAnchor = handle.anchor.type === 'cluster-corner' ? handle.anchor : null;
const cornerHandle = cornerAnchor
? manifest?.handles.find(
(candidate) =>
candidate.anchor.type === 'cluster-carriageway' &&
cornerAnchor.carriagewayKeys.includes(candidate.anchor.carriagewayKey),
)
: undefined;
const cornerSourceRoadId =
cornerHandle?.anchor.type === 'cluster-carriageway' ? cornerHandle.anchor.sourceRoadIds[0] : null;
const segmentId = 'segmentId' in handle.anchor ? handle.anchor.segmentId : null;
const cornerRoadId = handle.anchor.type === 'junction-corner' ? handle.anchor.incomingRoadId : null;
const road = state?.compiled.model.roads.find(
(item) =>
(roadId ? item.id === roadId : false) ||
(sourceRoadId ? item.id === sourceRoadId : false) ||
(cornerSourceRoadId ? item.id === cornerSourceRoadId : false) ||
(segmentId ? item.segmentId === segmentId : false) ||
(cornerRoadId ? item.id === cornerRoadId || item.segmentId === cornerRoadId : false),
);