feat: publish independent carriageway edge handles

This commit is contained in:
que01 committed 2026-09-10 13:56:12 +08:00
1 parent c77308c170
commit f722cadf25
3 files changed
+29 -1

No files matched your search

+25
View File
@@ -1621,6 +1621,31 @@ 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']) {
handles.push({
handleId: `handle:cluster-carriageway-edge-offset:${side}:${item.key}`,
kind: 'cluster-carriageway-edge-offset',
anchor: {
type: 'cluster-carriageway',
clusterId,
carriagewayKey: item.key,
side,
sourceNodeIds: item.sourceNodeIds,
sourceRoadIds: item.sourceRoadIds,
},
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 } : {}),
affects: [`complex-junction:${clusterId}:carriageway:${item.approach.segmentId}`],
editable: true,
});
}
}
}
return handles;
+3 -1
View File
@@ -113,7 +113,9 @@ export function constraintValueFor(
case 'cluster-carriageway-direction':
return { offsetDegrees: scalar };
case 'cluster-carriageway-edge-offset':
return { leftOffsetMeters: scalar, rightOffsetMeters: 0 };
return handle.anchor.type === 'cluster-carriageway' && handle.anchor.side === 'right'
? { leftOffsetMeters: 0, rightOffsetMeters: scalar }
: { leftOffsetMeters: scalar, rightOffsetMeters: 0 };
case 'cluster-corner-radius':
return { radiusMeters: Math.max(0, scalar) };
case 'junction-cutback':
+1
View File
@@ -79,6 +79,7 @@ export type SemanticAnchor =
carriagewayKey: string;
sourceNodeIds: string[];
sourceRoadIds: string[];
side?: Side;
}
| { type: 'junction-crossing'; crossingId: string; nodeId: string; segmentId: string; roadId: string }
| { type: 'junction-corner'; nodeId: string; incomingRoadId: string; outgoingRoadId: string };