feat(junction): edit complex crossing facilities

This commit is contained in:
que01 committed 2026-09-08 15:05:00 +08:00
1 parent bb5dc01c07
commit 49a44fdf73
16 files changed
+307 -39

No files matched your search

+9 -5
View File
@@ -268,7 +268,9 @@ function App() {
(handle) =>
(handle.kind === 'cluster-carriageway-width' ||
handle.kind === 'cluster-carriageway-cutback' ||
handle.kind === 'cluster-corner-radius') &&
handle.kind === 'cluster-corner-radius' ||
handle.kind === 'cluster-crossing-inset' ||
handle.kind === 'cluster-stop-line-offset') &&
'clusterId' in handle.anchor &&
handle.anchor.clusterId === junctionDescriptor.ref.id,
);
@@ -334,16 +336,17 @@ function App() {
const [element, setElement] = useState<ElementSelection | null>(null);
const visibleEditHandles = useMemo(() => {
if (!element || element.kind === 'lane-maneuver') return editHandles;
const constraintKind = specOfKind(element.kind).constraintKind;
const constraintKind = element.constraintKind ?? specOfKind(element.kind).constraintKind;
// Control markings use the selected outline itself as their drag target,
// exactly like lane-maneuver. Keep the selected control in the index so the
// outline can resolve its semantics, while the layer hides its duplicate dot.
return editHandles.filter(
(handle) =>
!handle.kind.startsWith('junction-cross') ||
(!handle.kind.startsWith('junction-cross') && !handle.kind.startsWith('cluster-cross')) ||
(handle.kind === constraintKind &&
handle.anchor.type === 'junction-crossing' &&
String(handle.anchor.crossingId) === String(element.crossingNodeId)),
((handle.anchor.type === 'junction-crossing' &&
String(handle.anchor.crossingId) === String(element.crossingNodeId)) ||
(handle.anchor.type === 'cluster-crossing' && handle.anchor.crossingKey === element.crossingNodeId))),
);
}, [editHandles, element]);
/**
@@ -1316,6 +1319,7 @@ function App() {
const feature = source?.features.find((item) => {
if (facility.kind === 'signal')
return String(item.properties?.signal_uid) === facility.id.slice('signal:'.length);
if (facility.crossingKey) return String(item.properties?.crossing_key) === facility.crossingKey;
return String(item.properties?.crossing_node_id) === facility.id.split(':').slice(1).join(':');
});
if (feature) handleFeature(feature.properties ?? {});