Map: larger marker icons at every zoom level
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
b4681bd123
commit
1c9634b5d3
1 changed files with 12 additions and 9 deletions
|
|
@ -202,11 +202,7 @@ class MapView {
|
||||||
const catKey = `${marker.group_name}/${marker.category_name}`;
|
const catKey = `${marker.group_name}/${marker.category_name}`;
|
||||||
if (!mapData.visibleCategories.has(catKey)) continue;
|
if (!mapData.visibleCategories.has(catKey)) continue;
|
||||||
|
|
||||||
// Marker size based on zoom
|
const iconSize = this.markerSize();
|
||||||
let iconSize = 12;
|
|
||||||
if (this.zoom >= 4) iconSize = 16;
|
|
||||||
if (this.zoom >= 5) iconSize = 20;
|
|
||||||
if (this.zoom >= 6) iconSize = 24;
|
|
||||||
|
|
||||||
const screen = this.worldToScreen(marker.worldX, marker.worldY);
|
const screen = this.worldToScreen(marker.worldX, marker.worldY);
|
||||||
|
|
||||||
|
|
@ -226,9 +222,7 @@ class MapView {
|
||||||
} else {
|
} else {
|
||||||
// Fallback to emoji if no icon available
|
// Fallback to emoji if no icon available
|
||||||
const symbol = CONFIG.CATEGORY_SYMBOLS[marker.category_name] || '📍';
|
const symbol = CONFIG.CATEGORY_SYMBOLS[marker.category_name] || '📍';
|
||||||
let fontSize = 8;
|
const fontSize = Math.round(iconSize * 0.75);
|
||||||
if (this.zoom >= 5) fontSize = 12;
|
|
||||||
if (this.zoom >= 6) fontSize = 16;
|
|
||||||
|
|
||||||
ctx.font = `${fontSize}px sans-serif`;
|
ctx.font = `${fontSize}px sans-serif`;
|
||||||
ctx.textAlign = 'center';
|
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
|
* Zoom in
|
||||||
*/
|
*/
|
||||||
|
|
@ -327,7 +330,7 @@ class MapView {
|
||||||
/**
|
/**
|
||||||
* Find nearest marker to screen position
|
* 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 nearest = null;
|
||||||
let nearestDist = threshold;
|
let nearestDist = threshold;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue