added invisiblity support
This commit is contained in:
parent
6235e0c14e
commit
c97767b8f9
2 changed files with 23 additions and 3 deletions
BIN
invi.png
Normal file
BIN
invi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
26
map.html
26
map.html
|
@ -59,6 +59,16 @@
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
var self_icons = icons;
|
var self_icons = icons;
|
||||||
|
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
|
// INIT MAP
|
||||||
|
@ -93,10 +103,18 @@
|
||||||
console.log("changeColor", data);
|
console.log("changeColor", data);
|
||||||
colors[data.id] = data.color;
|
colors[data.id] = data.color;
|
||||||
if(data.id in markers){
|
if(data.id in markers){
|
||||||
if(data.id == id)
|
if(data.id == id)
|
||||||
markers[data.id].setIcon(self_icons[data.color]);
|
if(data.color == -1)
|
||||||
|
markers[data.id].setIcon(self_invisible);
|
||||||
|
else
|
||||||
|
markers[data.id].setIcon(self_icons[data.color]);
|
||||||
else
|
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]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -111,6 +129,8 @@
|
||||||
else
|
else
|
||||||
icon = icons[colors[data.id]];
|
icon = icons[colors[data.id]];
|
||||||
markers[data.id] = L.marker(data.position, {"icon": icon}).addTo(map);
|
markers[data.id] = L.marker(data.position, {"icon": icon}).addTo(map);
|
||||||
|
if(data.id == id)
|
||||||
|
markers[data.id].setZIndexOffset(10000);
|
||||||
if(data.id in names)
|
if(data.id in names)
|
||||||
markers[data.id].bindPopup(names[data.id]);
|
markers[data.id].bindPopup(names[data.id]);
|
||||||
} else{
|
} else{
|
||||||
|
|
Loading…
Reference in a new issue