From 117e4935f51ab054a037bd599838544a9e561e32 Mon Sep 17 00:00:00 2001 From: leosw Date: Tue, 20 Oct 2026 17:05:52 +0200 Subject: [PATCH] =?UTF-8?q?Tailles=20diff=C3=A9rentes=20des=20icones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/views/js/d.map.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/public/views/js/d.map.js b/public/views/js/d.map.js index 724093f..e293df5 100755 --- a/public/views/js/d.map.js +++ b/public/views/js/d.map.js @@ -89,16 +89,23 @@ $(document).ready(function() { return { color: "#ef2929", size: 14, shape: "square" }; } - function buildPoiVectorIcon(properties) { + function buildPoiVectorIcon(properties, zoom) { var type = (properties && (properties.type || properties.poi_type || properties.poiType)) || "default"; var style = getPoiStyle(type); - var iconUrl = svgDataUriFor(style.color, style.size, style.shape); + var scale = 1; + if (zoom === 8) { + scale = 1.1; + } else if (zoom >= 9) { + scale = 1.2; + } + var size = Math.max(1, Math.round(style.size * scale)); + var iconUrl = svgDataUriFor(style.color, size, style.shape); return L.icon({ iconUrl: iconUrl, - iconSize: [style.size, style.size], - iconAnchor: [Math.floor(style.size / 2), style.size], - popupAnchor: [0, -style.size] + iconSize: [size, size], + iconAnchor: [Math.floor(size / 2), size], + popupAnchor: [0, -size] }); } @@ -111,7 +118,7 @@ $(document).ready(function() { pane: 'vectorPane', vectorTileLayerStyles: { pois: function(properties, zoom) { - var icon = buildPoiVectorIcon(properties); + var icon = buildPoiVectorIcon(properties, zoom); return { icon: icon,