fix(geoportal): Google satellite, ESC/right-click exit, no UAT fill, ANCPI bbox fix

Basemaps: added Google Satellite option
ANCPI ortofoto: fixed bbox conversion (all 4 corners, not just SW/NE)
Selection: ESC key and right-click exit selection mode, tooltips updated
UAT layers: removed fill (only lines + labels), less visual clutter
Proprietari vechi: greyed out (opacity-50) so current owners stand out

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-24 14:19:02 +02:00
parent 1cc73a3033
commit 3fcf7e2a67
6 changed files with 49 additions and 17 deletions
@@ -80,6 +80,13 @@ const BASEMAPS: Record<BasemapId, BasemapDef> = {
attribution: '&copy; <a href="https://www.esri.com">Esri</a>, Maxar',
tileSize: 256,
},
google: {
type: "raster",
tiles: ["https://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}"],
attribution: '&copy; Google',
tileSize: 256,
maxzoom: 20,
},
orto: {
type: "raster",
tiles: ["/api/eterra/tiles/orto?z={z}&x={x}&y={y}"],
@@ -383,15 +390,11 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
// === UAT z5-8: coarse ===
map.addSource(SOURCES.uatsZ5, { type: "vector", tiles: [`${m}/${SOURCES.uatsZ5}/{z}/{x}/{y}`], minzoom: 5, maxzoom: 8 });
map.addLayer({ id: LAYER_IDS.uatsZ5Fill, type: "fill", source: SOURCES.uatsZ5, "source-layer": SOURCES.uatsZ5, minzoom: 5, maxzoom: 8,
paint: { "fill-color": "#8b5cf6", "fill-opacity": 0.03 } });
map.addLayer({ id: LAYER_IDS.uatsZ5Line, type: "line", source: SOURCES.uatsZ5, "source-layer": SOURCES.uatsZ5, minzoom: 5, maxzoom: 8,
paint: { "line-color": "#7c3aed", "line-width": 0.6 } });
// === UAT z8-12: moderate ===
map.addSource(SOURCES.uatsZ8, { type: "vector", tiles: [`${m}/${SOURCES.uatsZ8}/{z}/{x}/{y}`], minzoom: 8, maxzoom: 12 });
map.addLayer({ id: LAYER_IDS.uatsZ8Fill, type: "fill", source: SOURCES.uatsZ8, "source-layer": SOURCES.uatsZ8, minzoom: 8, maxzoom: 12,
paint: { "fill-color": "#8b5cf6", "fill-opacity": 0.05 } });
map.addLayer({ id: LAYER_IDS.uatsZ8Line, type: "line", source: SOURCES.uatsZ8, "source-layer": SOURCES.uatsZ8, minzoom: 8, maxzoom: 12,
paint: { "line-color": "#7c3aed", "line-width": 1 } });
map.addLayer({ id: LAYER_IDS.uatsZ8Label, type: "symbol", source: SOURCES.uatsZ8, "source-layer": SOURCES.uatsZ8, minzoom: 9, maxzoom: 12,
@@ -400,8 +403,6 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
// === UAT z12+: full detail (no simplification) ===
map.addSource(SOURCES.uatsZ12, { type: "vector", tiles: [`${m}/${SOURCES.uatsZ12}/{z}/{x}/{y}`], minzoom: 12, maxzoom: 16 });
map.addLayer({ id: LAYER_IDS.uatsZ12Fill, type: "fill", source: SOURCES.uatsZ12, "source-layer": SOURCES.uatsZ12, minzoom: 12,
paint: { "fill-color": "#8b5cf6", "fill-opacity": 0.08 } });
map.addLayer({ id: LAYER_IDS.uatsZ12Line, type: "line", source: SOURCES.uatsZ12, "source-layer": SOURCES.uatsZ12, minzoom: 12,
paint: { "line-color": "#7c3aed", "line-width": 2 } });
map.addLayer({ id: LAYER_IDS.uatsZ12Label, type: "symbol", source: SOURCES.uatsZ12, "source-layer": SOURCES.uatsZ12, minzoom: 12,
@@ -473,7 +474,6 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
/* ---- Click handler — NO popup, only callback ---- */
const clickableLayers = [
LAYER_IDS.terenuriFill, LAYER_IDS.cladiriFill,
LAYER_IDS.uatsZ5Fill, LAYER_IDS.uatsZ8Fill, LAYER_IDS.uatsZ12Fill,
];
map.on("click", (e) => {
@@ -685,6 +685,25 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
canvas.addEventListener("mousemove", onRectMouseMove);
canvas.addEventListener("mouseup", onRectMouseUp);
/* ---- ESC key exits selection mode ---- */
const onKeyDown = (e: KeyboardEvent) => {
if (e.key === "Escape" && selectionTypeRef.current !== "off") {
onFeatureClick?.(null as unknown as ClickedFeature);
clearDrawState();
// Notify parent to turn off selection
onSelectionChange?.([]);
}
};
document.addEventListener("keydown", onKeyDown);
/* ---- Right-click exits selection / cancels draw ---- */
map.on("contextmenu", (e) => {
if (selectionTypeRef.current !== "off") {
e.preventDefault();
clearDrawState();
}
});
/* ---- Cursor change ---- */
for (const lid of clickableLayers) {
map.on("mouseenter", lid, () => { map.getCanvas().style.cursor = "pointer"; });
@@ -693,6 +712,7 @@ export const MapViewer = forwardRef<MapViewerHandle, MapViewerProps>(
/* ---- Cleanup ---- */
return () => {
document.removeEventListener("keydown", onKeyDown);
canvas.removeEventListener("mousedown", onRectMouseDown);
canvas.removeEventListener("mousemove", onRectMouseMove);
canvas.removeEventListener("mouseup", onRectMouseUp);