From 6d7374667052ebc80520abd6bceceee7bb29bca3 Mon Sep 17 00:00:00 2001 From: Nina Kin Date: Wed, 8 May 2024 12:53:52 -0700 Subject: [PATCH] marker z-index fix --- src/scripts/map.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/scripts/map.js b/src/scripts/map.js index 32c813a..b2424af 100644 --- a/src/scripts/map.js +++ b/src/scripts/map.js @@ -35,15 +35,21 @@ function parseCSV(file) { }); } -function createMarkerLayer(data, icon) { +function createMarkerLayer(data, icon, zIndexOffset = 0) { let markerLayer = L.layerGroup(); data.forEach(item => { let marker = L.marker([item.Latitude, item.Longitude], {icon: icon}); - + + if (zIndexOffset > 0) { + marker.setZIndexOffset(zIndexOffset); + } + marker.addTo(markerLayer); marker.bindPopup(`${item["Title"]}
By: ${item.ArtistName}
Medium: ${item.Medium}

${item["Location Name"]}
${item.AddressStreet}
${item.AddressCity}`).openPopup(); }); + + map.addLayer(markerLayer); } @@ -60,6 +66,6 @@ Promise.all([parseCSV(ART_DATA)]) }); createMarkerLayer(unfinishedArtworks, mapIconOutline); - createMarkerLayer(finishedArtworks, mapIconSolid); + createMarkerLayer(finishedArtworks, mapIconSolid, 10000); }) .catch(err => console.error(err)); \ No newline at end of file