diff --git a/src/modules/geoportal/components/map-viewer.tsx b/src/modules/geoportal/components/map-viewer.tsx index 3a62c23..733e51a 100644 --- a/src/modules/geoportal/components/map-viewer.tsx +++ b/src/modules/geoportal/components/map-viewer.tsx @@ -439,24 +439,23 @@ export const MapViewer = forwardRef( paint: { "fill-color": "#3b82f6", "fill-opacity": 0.5 } }); map.addLayer({ id: LAYER_IDS.cladiriLine, type: "line", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 14, paint: { "line-color": "#1e3a5f", "line-width": 0.6 } }); - // Building body labels (C1, C2...) — only at high zoom to avoid clutter - // cadastral_ref format: "77102-C1" → show "C1" - // Uses regex-like approach: if contains "-", show everything after last "-" - map.addLayer({ id: LAYER_IDS.cladiriLabel, type: "symbol", source: SOURCES.cladiri, "source-layer": SOURCES.cladiri, minzoom: 16, - filter: ["all", - ["has", "cadastral_ref"], - ["!=", ["index-of", "-", ["coalesce", ["get", "cadastral_ref"], ""]], -1], - ], + // Building body labels (C1, C2...) — visible at high zoom + // cadastral_ref = "77102-C1" → display "C1" + map.addLayer({ + id: LAYER_IDS.cladiriLabel, + type: "symbol", + source: SOURCES.cladiri, + "source-layer": SOURCES.cladiri, + minzoom: 16, + filter: ["has", "cadastral_ref"], layout: { - "text-field": ["slice", - ["coalesce", ["get", "cadastral_ref"], ""], - ["+", ["index-of", "-", ["coalesce", ["get", "cadastral_ref"], ""]], 1], - ], + // Simple approach: show full cadastral_ref, let the user see "77102-C1" + // MapLibre will auto-hide overlapping labels + "text-field": ["get", "cadastral_ref"], "text-font": ["Noto Sans Regular"], - "text-size": 11, + "text-size": 10, "text-anchor": "center", - "text-allow-overlap": true, - "text-ignore-placement": false, + "text-allow-overlap": false, }, paint: { "text-color": "#1e3a8a",