diff --git a/workbench/client/src/App.tsx b/workbench/client/src/App.tsx index fa2f876..b379d14 100644 --- a/workbench/client/src/App.tsx +++ b/workbench/client/src/App.tsx @@ -188,9 +188,15 @@ function App() { if (!directEditEnabled || !element || !state) return null; const handle = crosswalkHandleFor(element, state.compiled.model.roads, editHandles); if (!handle?.editable) return null; - const bounds = orientedBoundsOf(groupMembers(state.layers.crosswalks?.features ?? [], element.elementId)); + // Read the preview when there is one. `state.layers` is the last *compiled* + // output and does not move during editing, so measuring the box there left it + // behind at the baseline while the zebra itself — drawn from the preview — + // slid out from under it. A null preview layer means "back to baseline", + // which is what the fallback expresses. + const drawn = preview?.crosswalks ?? state.layers.crosswalks; + const bounds = orientedBoundsOf(groupMembers(drawn?.features ?? [], element.elementId)); return bounds ? { handleId: handle.handleId, bounds } : null; - }, [element, editHandles, state]); + }, [element, editHandles, state, preview]); const sessionRef = useRef(null); if (directEditEnabled && !sessionRef.current) sessionRef.current = new EditSession(); // Per-frame drag feedback reaches the panel through this rather than through