perf: reduce junction preview handle and collision work

This commit is contained in:
que01 committed 2026-09-14 12:14:59 +08:00
1 parent 6a8f026d12
commit d0a4cfa7ff
11 files changed
+291 -5

No files matched your search

+19
View File
@@ -364,6 +364,25 @@ const clusterHandleResolution = resolveDirectEditConstraints(junctionModel, docu
junctionClusters: [{ id: 'cluster-1', nodeIds: ['junction'] }],
selection: { type: 'cluster', id: 'cluster-1' },
});
// Early handle scoping must equal filtering the full manifest, including when
// non-cluster constraints still need to participate in geometry solving.
for (const edits of [document([]), document(allKinds)]) {
const context = { junctionClusters: [{ id: 'cluster-1', nodeIds: ['junction'] }] };
const full = resolveDirectEditConstraints(junctionModel, edits, context);
const scoped = resolveDirectEditConstraints(junctionModel, edits, {
...context,
selection: { type: 'cluster', id: 'cluster-1' },
});
assert.deepEqual(scoped, {
...full,
handles: {
...full.handles,
handles: full.handles.handles.filter(
(handle) => handle.anchor?.clusterId === 'cluster-1' && handle.kind.startsWith('cluster-'),
),
},
});
}
const clusterWidthHandle = clusterHandleResolution.handles.handles.find(
(handle) => handle.kind === 'cluster-carriageway-width',
);