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

+1 -1
View File
@@ -206,7 +206,7 @@ describe('labelForHandle', () => {
outgoingRoadId: 'seg:2',
}),
),
).toBe('角部圆角');
).toBe('seg:1 → seg:2 · 角部圆角');
});
});
+7
View File
@@ -130,6 +130,13 @@ const KIND_LABELS: Record<ConstraintKind, string> = {
export function labelForHandle(handle: EditHandle): string {
const base = KIND_LABELS[handle.kind] ?? handle.kind;
const anchor = handle.anchor;
if (
(handle.kind === 'junction-approach-width' || handle.kind === 'junction-cutback') &&
anchor.type === 'junction-approach'
)
return `${anchor.segmentId} · ${base}`;
if (handle.kind === 'junction-corner-radius' && anchor.type === 'junction-corner')
return `${anchor.incomingRoadId} → ${anchor.outgoingRoadId} · ${base}`;
if ('boundaryIndex' in anchor && Number.isInteger(anchor.boundaryIndex)) return `${base} #${anchor.boundaryIndex}`;
if ('side' in anchor && anchor.side) return `${base}(${anchor.side === 'left' ? '左' : '右'})`;
return base;