diff --git a/public/css/events-map.css b/public/css/events-map.css index 76d05e20..74368f05 100644 --- a/public/css/events-map.css +++ b/public/css/events-map.css @@ -130,10 +130,11 @@ body.map-is-expanded .SiteHeader { display: block; } -.EventsMap .leaflet-marker-icon, +/* .EventsMap .leaflet-marker-icon, .EventsMap .leaflet-marker-shadow { - /* animation: fadein 0.75s; */ + animation: fadein 0.75s; } +*/ .EventsMap .leaflet-popup { max-width: 80vw; diff --git a/public/js/events-map.js b/public/js/events-map.js index 7557fb93..6154be08 100644 --- a/public/js/events-map.js +++ b/public/js/events-map.js @@ -157,14 +157,14 @@ function setLayerIcon(layer, map, classToAdd = "", innerText = "") { function getLayerIcon(layer, map, classToAdd = "", innerText = "") { const zoomLevel = map.getZoom(); - let markerType; // normal | cluster | spiderfied - if (layer instanceof L.MarkerCluster) { - markerType = "cluster"; - } else if (layer instanceof L.Marker) { - markerType = "normal"; - } else { - console.log("Unknown marker type", layer); - } + // let markerType; // normal | cluster | spiderfied + // if (layer instanceof L.MarkerCluster) { + // markerType = "cluster"; + // } else if (layer instanceof L.Marker) { + // markerType = "normal"; + // } else { + // console.log("Unknown marker type", layer); + // } // console.log("markerType", markerType); // Brottstyp utan mellanslag mellan ord (så max 1 mellanslag efter varandra). @@ -348,11 +348,14 @@ class EventsMap { } }); + this.map.on("locateactivate", () => { + expandMap(this.map); + }); + /** * Set icons depending on zoom level. */ this.map.on("zoomend", () => { - console.log("on zoomend"); // For each marker, set the icon. this.map.eachLayer(function (layer) { // Ensure to act only on markers with crime events data. @@ -386,14 +389,13 @@ class EventsMap { '© OSM', }).addTo(this.map); - let x = L.control + L.control .ExpandButton({ position: "bottomright", }) .addTo(this.map); - window.expandButtonControl = x; - L.control + window.locateControl = L.control .locate({ locateOptions: { maxZoom: 11,