|
|
|
@ -64,6 +64,8 @@ function leafletMap() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map.openedPanelIconID = null;
|
|
|
|
|
|
|
|
|
|
map.updatePackageLayer = function (data) {
|
|
|
|
|
map.packagelayer.clearLayers();
|
|
|
|
|
|
|
|
|
@ -77,10 +79,21 @@ function leafletMap() {
|
|
|
|
|
var iconName = getMapIconForItems(datai.items);
|
|
|
|
|
//console.log(iconName);
|
|
|
|
|
|
|
|
|
|
var classes = "package-marker package-marker-leaflet";
|
|
|
|
|
|
|
|
|
|
// Prevent selection highlight from going away after map refresh
|
|
|
|
|
if (map.openedPanelIconID != null && map.openedPanelIconID == datai.id) {
|
|
|
|
|
classes += " selected";
|
|
|
|
|
}
|
|
|
|
|
// Show different color highlight when nearby
|
|
|
|
|
if (packages[i].distance * 1 < getStorage("alertradius") * 1) {
|
|
|
|
|
classes += " alerted";
|
|
|
|
|
}
|
|
|
|
|
var icon = L.icon({
|
|
|
|
|
iconUrl: "assets/images/" + iconName + ".png",
|
|
|
|
|
iconSize: [25, 25],
|
|
|
|
|
iconAnchor: [12.5, 12.5]
|
|
|
|
|
iconAnchor: [12.5, 12.5],
|
|
|
|
|
className: classes
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var marker = L.marker(
|
|
|
|
@ -93,12 +106,11 @@ function leafletMap() {
|
|
|
|
|
})
|
|
|
|
|
.on("click", function () {
|
|
|
|
|
marker._icon.id = "marker-" + datai.id;
|
|
|
|
|
marker._icon.classList.add('package-marker');
|
|
|
|
|
marker._icon.classList.add('package-marker-leaflet');
|
|
|
|
|
openPackageInfoSheet(datai.id);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
map.packagelayer.addLayer(marker);
|
|
|
|
|
|
|
|
|
|
//L.DomUtil.addClass(marker._icon, 'package-marker'); // enable selected CSS to work correctly
|
|
|
|
|
})(data[i]);
|
|
|
|
|
}
|
|
|
|
|