feat(junction): enable complex carriageway width editing
This commit is contained in:
1 parent
56647fcdaa
commit
c4bcbe8ff9
22 files changed
+449
-52
No files matched your search
@@ -262,7 +262,14 @@ function App() {
|
||||
// the same manifest objects and callbacks as the main parameter panel so
|
||||
// number entry and dragging share one preview/undo protocol.
|
||||
const junctionHandles = useMemo(() => {
|
||||
if (!editMode || !junctionDescriptor || junctionDescriptor.ref.type !== 'node' || !manifest) return [];
|
||||
if (!junctionDescriptor || !manifest) return [];
|
||||
if (junctionDescriptor.ref.type === 'cluster')
|
||||
return manifest.handles.filter(
|
||||
(handle) =>
|
||||
handle.kind === 'cluster-carriageway-width' &&
|
||||
handle.anchor.type === 'cluster-carriageway' &&
|
||||
handle.anchor.clusterId === junctionDescriptor.ref.id,
|
||||
);
|
||||
const nodeIds = new Set(junctionDescriptor.nodeIds.map(String));
|
||||
return manifest.handles.filter(
|
||||
(handle) =>
|
||||
@@ -274,7 +281,7 @@ function App() {
|
||||
'nodeId' in handle.anchor &&
|
||||
nodeIds.has(String(handle.anchor.nodeId)),
|
||||
);
|
||||
}, [editMode, junctionDescriptor, manifest]);
|
||||
}, [junctionDescriptor, manifest]);
|
||||
const junctionFacilitySummary = useMemo(() => {
|
||||
if (!junctionDescriptor || !state) return { crosswalks: 0, stopLines: 0, signals: 0 };
|
||||
const nodeIds = new Set(junctionDescriptor.nodeIds.map(String));
|
||||
@@ -478,11 +485,13 @@ function App() {
|
||||
// compiled model before building the anchor snapshot. Without this branch
|
||||
// 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 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) ||
|
||||
(segmentId ? item.segmentId === segmentId : false) ||
|
||||
(cornerRoadId ? item.id === cornerRoadId || item.segmentId === cornerRoadId : false),
|
||||
);
|
||||
@@ -1105,7 +1114,7 @@ function App() {
|
||||
onSignalDragEnd={finishSignalMove}
|
||||
onSignalRotate={rotateSignal}
|
||||
onSignalRotateEnd={finishSignalRotate}
|
||||
handles={visibleEditHandles}
|
||||
handles={junctionRoute ? junctionHandles : visibleEditHandles}
|
||||
ranges={editRanges}
|
||||
element={elementOutline}
|
||||
laneSelectionBounds={laneSelectionBounds}
|
||||
|
||||
Reference in new issue
Block a user