From 8acafe958bd85fd378d1a885b9565273d3c66272 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Wed, 25 Mar 2026 07:11:16 +0200 Subject: [PATCH] fix: freehand drawing, click highlight, mobile toolbar visibility Freehand drawing fix: - Disable dragPan when in freehand mode (was only disabling dblclick zoom). Without this, clicks were interpreted as pan gestures. - Re-enable dragPan when exiting freehand mode. Click highlight: - Clicking a parcel in "off" mode now highlights it with the selection layer (amber fill + orange outline). Clicking empty space clears it. - Provides visual feedback for which parcel was clicked. Mobile toolbar: - Moved selection toolbar higher (bottom-12 on mobile) with z-20 to ensure it's above MapLibre attribution bar. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/app/(portal)/portal/page.tsx | 4 ++-- .../geoportal/components/map-viewer.tsx | 21 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) 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]);