diff --git a/src/app/(portal)/portal/page.tsx b/src/app/(portal)/portal/page.tsx index 74ae5f5..32e793c 100644 --- a/src/app/(portal)/portal/page.tsx +++ b/src/app/(portal)/portal/page.tsx @@ -1597,8 +1597,8 @@ function HartaContent() { )} - {/* Bottom: selection toolbar — centered on mobile, above attribution */} -
+ {/* Bottom: selection toolbar — centered, above attribution */} +
( }); if (features.length === 0) { + // Clear highlight when clicking empty space + try { + map.setFilter(LAYER_IDS.selectionFill, ["==", "object_id", "__NONE__"]); + map.setFilter(LAYER_IDS.selectionLine, ["==", "object_id", "__NONE__"]); + } catch { /* noop */ } onFeatureClick?.(null as unknown as ClickedFeature); // close panel return; } @@ -519,8 +524,16 @@ export const MapViewer = forwardRef( return; } - // Feature click — notify parent (no popup) — only when off or click mode on non-terenuri + // Feature click — notify parent (no popup) — only when off if (mode === "off") { + // Highlight clicked parcel with selection layer + const objectId = String(props.object_id ?? ""); + if (objectId && sourceLayer === SOURCES.terenuri) { + try { + map.setFilter(LAYER_IDS.selectionFill, ["==", "object_id", objectId]); + map.setFilter(LAYER_IDS.selectionLine, ["==", "object_id", objectId]); + } catch { /* noop */ } + } onFeatureClick?.({ layerId: first.layer?.id ?? "", sourceLayer, @@ -734,14 +747,18 @@ export const MapViewer = forwardRef( mapRef.current.flyTo({ center, zoom: zoom ?? mapRef.current.getZoom(), duration: 1500 }); }, [center, zoom, mapReady]); - /* ---- Disable double-click zoom when in freehand mode ---- */ + /* ---- Disable interactions when in drawing modes ---- */ useEffect(() => { const map = mapRef.current; if (!map) return; if (selectionType === "freehand") { map.doubleClickZoom.disable(); + map.dragPan.disable(); + } else if (selectionType === "rect") { + // rect handles dragPan itself in mousedown/mouseup } else { map.doubleClickZoom.enable(); + map.dragPan.enable(); } }, [selectionType, mapReady]);