Skip to content

Commit

Permalink
Merge pull request #1 from maptimeLA/fix-marker-z-index
Browse files Browse the repository at this point in the history
marker z-index fix
  • Loading branch information
matikin9 authored May 8, 2024
2 parents 55d725e + 6d73746 commit 09981d4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/scripts/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`<b>${item["Title"]}</b><br>By: ${item.ArtistName}<br>Medium: ${item.Medium}<br><br>${item["Location Name"]}<br>${item.AddressStreet}<br>${item.AddressCity}`).openPopup();
});


map.addLayer(markerLayer);
}

Expand All @@ -60,6 +66,6 @@ Promise.all([parseCSV(ART_DATA)])
});

createMarkerLayer(unfinishedArtworks, mapIconOutline);
createMarkerLayer(finishedArtworks, mapIconSolid);
createMarkerLayer(finishedArtworks, mapIconSolid, 10000);
})
.catch(err => console.error(err));

0 comments on commit 09981d4

Please sign in to comment.