feat: publish complex carriageway position handles

This commit is contained in:
que01 committed 2026-09-10 13:46:05 +08:00
1 parent 53b63ae333
commit c77308c170
2 files changed
+31 -2

No files matched your search

+30 -1
View File
@@ -180,7 +180,13 @@ function constraintFor(constraints, kind, anchor) {
item.anchor.clusterId === anchor.clusterId &&
item.anchor.carriagewayKey === anchor.carriagewayKey
);
if (kind === 'cluster-carriageway-transition-length' || kind === 'cluster-carriageway-cutback')
if (
kind === 'cluster-carriageway-transition-length' ||
kind === 'cluster-carriageway-cutback' ||
kind === 'cluster-carriageway-position' ||
kind === 'cluster-carriageway-direction' ||
kind === 'cluster-carriageway-edge-offset'
)
return (
item.anchor.type === 'cluster-carriageway' &&
item.anchor.clusterId === anchor.clusterId &&
@@ -1592,6 +1598,29 @@ function makeClusterCarriagewayHandles(model, junctionData, constraints, cluster
affects: [`complex-junction:${clusterId}:carriageway:${item.approach.segmentId}`],
editable: true,
});
for (const [kind, field, unit, min, max] of [
['cluster-carriageway-position', 'offsetMeters', 'meter', -20, 20],
['cluster-carriageway-direction', 'offsetDegrees', 'degree', -15, 15],
]) {
const edit = constraintFor(constraints, kind, { clusterId, carriagewayKey: item.key });
handles.push({
handleId: `handle:${kind}:${item.key}`,
kind,
anchor: {
type: 'cluster-carriageway',
clusterId,
carriagewayKey: item.key,
sourceNodeIds: item.sourceNodeIds,
sourceRoadIds: item.sourceRoadIds,
},
position: point,
axisAzimuth: tangentAzimuth(line, station),
value: { current: numericValue(edit, field, 0), min, max, unit },
...(edit ? { constraintId: edit.id } : {}),
affects: [`complex-junction:${clusterId}:carriageway:${item.approach.segmentId}`],
editable: true,
});
}
}
}
return handles;
+1 -1
View File
@@ -93,7 +93,7 @@ export interface EditHandle {
position: [number, number];
/** Draggable direction, degrees clockwise from true north. */
axisAzimuth: number;
value: { current: number; min: number; max: number; unit: 'meter' };
value: { current: number; min: number; max: number; unit: 'meter' | 'degree' };
constraintId?: string;
/** `native_id` of every derived feature this handle changes. */
affects: string[];