fix: expose and apply control marking handles
This commit is contained in:
@@ -204,8 +204,15 @@ function App() {
|
||||
}, []);
|
||||
/** A drag becomes one drafted constraint layered over the session's document. */
|
||||
const draftFor = (handle: EditHandle, value: number): PreviewDraft | null => {
|
||||
// Road-anchored edits carry a directional road id. Junction-approach
|
||||
// controls are keyed by segment instead, so resolve them through the
|
||||
// compiled model before building the anchor snapshot. Without this branch
|
||||
// control handles silently returned null and never scheduled a preview.
|
||||
const roadId = 'roadId' in handle.anchor ? handle.anchor.roadId : null;
|
||||
const road = roadId ? state?.compiled.model.roads.find((item) => item.id === roadId) : undefined;
|
||||
const segmentId = 'segmentId' in handle.anchor ? handle.anchor.segmentId : null;
|
||||
const road = state?.compiled.model.roads.find(
|
||||
(item) => (roadId ? item.id === roadId : false) || (segmentId ? item.segmentId === segmentId : false),
|
||||
);
|
||||
// Without a centerline there is no snapshot to record, so drop the drag rather
|
||||
// than send a constraint the server would have to reject.
|
||||
if (!session || !road || road.centerline.length < 2) return null;
|
||||
|
||||
Reference in New Issue
Block a user