feat(workbench): stabilize junction tools workspace

This commit is contained in:
que01 committed 2026-09-04 09:46:19 +08:00
1 parent e6b822416d
commit f10a5da325
22 files changed
+1078 -53

No files matched your search

+11 -4
View File
@@ -961,7 +961,12 @@ function makeJunctionHandles(model, junctionData, constraints) {
const road = match.road;
const line = approach.endpoint.side === 'start' ? road.centerline : [...road.centerline].reverse();
const tangent = tangentAzimuth(line, Math.min(0.95, approach.cutback / approach.length));
const placementAzimuth = tangent;
// `line` is oriented from the junction outward. Native control geometry
// follows the road centerline orientation, which is outward for a `start`
// endpoint and inward for an `end` endpoint. Derive this per approach;
// assuming every arm has the same endpoint side reverses half the handles.
const approachAzimuth = approach.endpoint.side === 'start' ? tangent : (tangent + 180) % 360;
const placementAzimuth = approachAzimuth;
const anchorBase = {
type: 'junction-crossing',
crossingId: String(crossing.id),
@@ -990,7 +995,8 @@ function makeJunctionHandles(model, junctionData, constraints) {
// along the approach, not a reliable screen station from the junction;
// deriving the point from junction distance put the knob off the zebra.
position: offsetCoordinate(crossing.coordinate, placementAzimuth, insetApplied),
axisAzimuth: (tangent + 180) % 360,
// Increasing inset moves the crossing toward the junction.
axisAzimuth: approachAzimuth,
value: { current: insetValue, min: 0, max: insetMax, unit: 'meter' },
...(insetConstraint ? { constraintId: insetConstraint.id } : {}),
affects: [`crosswalk:node/${crossing.id}`],
@@ -1010,8 +1016,9 @@ function makeJunctionHandles(model, junctionData, constraints) {
-stopValue,
),
// The compiled stop line applies `-offset` along the approach axis, so
// this tangent is the positive drag direction for increasing offset.
axisAzimuth: tangent,
// Increasing the offset moves away from the junction, opposite to the
// approach axis used by the compiled stop-line geometry.
axisAzimuth: (approachAzimuth + 180) % 360,
value: {
current: stopValue,
min: MIN_STOP_LINE_OFFSET_METERS,