fix: outline selected turn arrows

This commit is contained in:
que01 committed 2026-09-01 09:21:24 +08:00
1 parent 2415733597
commit 3d135761e7
2 files changed
+49 -3

No files matched your search

+12
View File
@@ -15,6 +15,7 @@ import {
} from './edit/element';
import { directEditEnabled, intervalEditingSupported } from './edit/flag';
import type { ElementOutline } from './edit/handle-layer';
import type { Coordinate } from './edit/meters';
import { rendersSame } from './edit/parameter';
import { PreviewRequester, type PreviewDraft } from './edit/preview-request';
import { anchorSnapshotFor, constraintValueFor, draftConstraint, operationFor } from './edit/projection';
@@ -201,6 +202,16 @@ function App() {
const bounds = orientedBoundsOf(groupMembers(drawn?.features ?? [], element.elementId));
return bounds ? { handleId: handle.handleId, bounds } : null;
}, [element, editHandles, state, preview]);
const laneSelectionBounds = useMemo<Coordinate[] | null>(() => {
if (!element || element.kind !== 'lane-maneuver' || !state || !element.featureIds.length) return null;
const ids = new Set(element.featureIds);
return orientedBoundsOf(
state.layers.turnArrows?.features.filter((feature) => {
const nativeId = feature.properties?.native_id;
return typeof nativeId === 'string' && ids.has(nativeId);
}) ?? [],
);
}, [element, state]);
const sessionRef = useRef<EditSession | null>(null);
if (directEditEnabled && !sessionRef.current) sessionRef.current = new EditSession();
// Per-frame drag feedback reaches the panel through this rather than through
@@ -623,6 +634,7 @@ function App() {
handles={editHandles}
ranges={editRanges}
element={elementOutline}
laneSelectionBounds={laneSelectionBounds}
preview={preview}
ghostPending={session?.degraded ?? false}
onHandleDrag={(handle, value) => {