diff --git a/invi.png b/invi.png new file mode 100644 index 0000000..ee96642 Binary files /dev/null and b/invi.png differ diff --git a/map.html b/map.html index b2dd1df..1f57b8a 100644 --- a/map.html +++ b/map.html @@ -59,7 +59,16 @@ }) ]; var self_icons = icons; - var self_invisible_icon = icons[1]; + var self_invisible = + L.icon({ + iconUrl: 'invi.png', + iconSize: [10, 10], + iconAnchor: [5, 5], + popupAnchor: [5, 5], + //shadowUrl: 'my-icon-shadow.png', + //shadowSize: [68, 95], + //shadowAnchor: [22, 94] + }); ////////////////////////////////////////////////////////////////////////////// // INIT MAP @@ -95,18 +104,19 @@ if(data.id in colors && colors[data.id] == -1 && data.id in markers) markers[data.id].addTo(map); colors[data.id] = data.color; - if(data.color == -1){ - if(data.id in markers){ - if(data.id == id) - markers[data.id].setIcon(self_invisible_icon); - else - markers[data.id].remove(); - } - } else if(data.id in markers){ - if(data.id == id) - markers[data.id].setIcon(self_icons[data.color]); + if(data.id in markers){ + if(data.id == id) + if(data.color == -1) + markers[data.id].setIcon(self_invisible); + else + markers[data.id].setIcon(self_icons[data.color]); else - markers[data.id].setIcon(icons[data.color]); + if(data.color == -1) + markers[data.id].setOpacity(0); + else{ + markers[data.id].setOpacity(1); + markers[data.id].setIcon(icons[data.color]); + } } }); @@ -121,8 +131,8 @@ else icon = icons[colors[data.id]]; markers[data.id] = L.marker(data.position, {"icon": icon}).addTo(map); - if(colors[data.id] == -1) - markers[data.id].remove(); + if(data.id == id) + markers[data.id].setZIndexOffset(10000); if(data.id in names) markers[data.id].bindPopup(names[data.id]); } else{