Skip to content

Commit

Permalink
Ändra inte ikon på current-location-marker
Browse files Browse the repository at this point in the history
  • Loading branch information
bonny committed May 12, 2024
1 parent 350a0ca commit d7625cb
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions resources/views/components/events-map.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ className: 'EventsMap-marker-icon EventsMap-marker-icon--far',
var markerIconNear = L.divIcon({
className: 'EventsMap-marker-icon EventsMap-marker-icon--near',
iconSize: [25, 25],
html: ''
});
class EventsMap {
Expand Down Expand Up @@ -97,7 +98,9 @@ class EventsMap {
.bindPopup(`
<div class="EventsMap-marker-content">
<div class="EventsMap-marker-contentImage">
<img class="EventsMap-marker-image" src="${event.image}" alt="" />
<a href="${event.permalink}?utm_source=brottsplatskartan&utm_content=maplink">
<img class="EventsMap-marker-image" src="${event.image}" alt="" />
</a>
</div>
<a href="${event.permalink}?utm_source=brottsplatskartan&utm_content=maplink" class="EventsMap-marker-contentText EventsMap-marker-contentLink">
${event.time}${event.type}
Expand Down Expand Up @@ -160,14 +163,17 @@ class EventsMap {
*/
this.map.on('zoomend', () => {
if (this.map.getZoom() >= 10) {
let prevIcon;
this.map.eachLayer(function(layer) {
if (layer instanceof L.Marker) {
if (layer instanceof L.Marker && layer._icon.classList.contains(
'EventsMap-marker-icon')) {
layer.setIcon(markerIconNear);
}
});
} else {
this.map.eachLayer(function(layer) {
if (layer instanceof L.Marker) {
if (layer instanceof L.Marker && layer._icon.classList.contains(
'EventsMap-marker-icon')) {
layer.setIcon(markerIconFar);
}
});
Expand Down Expand Up @@ -247,7 +253,7 @@ class EventsMap {
.EventsMap.is-expanded {
position: fixed !important;
height: 100vh;
height: 100dvh;
top: 0;
left: 0;
right: 0;
Expand Down

0 comments on commit d7625cb

Please sign in to comment.