diff --git a/assets/map/js/views/MapView.js b/assets/map/js/views/MapView.js index 50f71e2..db5ca1b 100644 --- a/assets/map/js/views/MapView.js +++ b/assets/map/js/views/MapView.js @@ -202,11 +202,7 @@ class MapView { const catKey = `${marker.group_name}/${marker.category_name}`; if (!mapData.visibleCategories.has(catKey)) continue; - // Marker size based on zoom - let iconSize = 12; - if (this.zoom >= 4) iconSize = 16; - if (this.zoom >= 5) iconSize = 20; - if (this.zoom >= 6) iconSize = 24; + const iconSize = this.markerSize(); const screen = this.worldToScreen(marker.worldX, marker.worldY); @@ -226,9 +222,7 @@ class MapView { } else { // Fallback to emoji if no icon available const symbol = CONFIG.CATEGORY_SYMBOLS[marker.category_name] || '📍'; - let fontSize = 8; - if (this.zoom >= 5) fontSize = 12; - if (this.zoom >= 6) fontSize = 16; + const fontSize = Math.round(iconSize * 0.75); ctx.font = `${fontSize}px sans-serif`; ctx.textAlign = 'center'; @@ -238,6 +232,15 @@ class MapView { } } + /** + * Groesse der Marker-Icons in Pixeln - waechst mit der Zoomstufe, damit man sie auch + * herausgezoomt noch erkennt. + */ + markerSize() { + const sizes = { 2: 20, 3: 24, 4: 28, 5: 32, 6: 38 }; + return sizes[this.zoom] || (this.zoom < 2 ? 18 : 38); + } + /** * Zoom in */ @@ -327,7 +330,7 @@ class MapView { /** * Find nearest marker to screen position */ - findNearestMarker(mapData, screenX, screenY, threshold = 20) { + findNearestMarker(mapData, screenX, screenY, threshold = this.markerSize() * 0.7) { let nearest = null; let nearestDist = threshold;