feat(junction): expose transition length handle

This commit is contained in:
que01 committed 2026-09-09 15:40:41 +08:00
1 parent 21c05800c0
commit 801d8be980
1 file changed
+34 -1
+34 -1
View File
@@ -174,7 +174,7 @@ function constraintFor(constraints, kind, anchor) {
item.anchor.clusterId === anchor.clusterId &&
item.anchor.carriagewayKey === anchor.carriagewayKey
);
if (kind === 'cluster-carriageway-cutback')
if (kind === 'cluster-carriageway-transition-length' || kind === 'cluster-carriageway-cutback')
return (
item.anchor.type === 'cluster-carriageway' &&
item.anchor.clusterId === anchor.clusterId &&
@@ -1456,6 +1456,39 @@ function makeClusterCarriagewayHandles(model, junctionData, constraints, cluster
affects: [`complex-junction:${clusterId}:carriageway:${item.approach.segmentId}`],
editable: true,
});
const transitionConstraint = constraintFor(constraints, 'cluster-carriageway-transition-length', {
clusterId,
carriagewayKey: item.key,
});
handles.push({
handleId: `handle:cluster-carriageway-transition-length:${item.key}`,
kind: 'cluster-carriageway-transition-length',
anchor: {
type: 'cluster-carriageway',
clusterId,
carriagewayKey: item.key,
sourceNodeIds: item.sourceNodeIds,
sourceRoadIds: item.sourceRoadIds,
},
position: point,
axisAzimuth: tangentAzimuth(line, station),
value: {
current: numericValue(
transitionConstraint,
'transitionLengthMeters',
Math.max(0, item.approach.length - item.approach.cutback),
),
min: complexJunctionMetrics(cluster).minimumTransitionMeters,
max: Math.max(
complexJunctionMetrics(cluster).minimumTransitionMeters,
complexJunctionMetrics(cluster).approachOuterRadius - complexJunctionMetrics(cluster).approachInnerRadius,
),
unit: 'meter',
},
...(transitionConstraint ? { constraintId: transitionConstraint.id } : {}),
affects: [`complex-junction:${clusterId}:carriageway:${item.approach.segmentId}`],
editable: true,
});
const cutbackConstraint = constraintFor(constraints, 'cluster-carriageway-cutback', {
clusterId,
carriagewayKey: item.key,