ajouté popups
This commit is contained in:
parent
58de2f159c
commit
4b10f28ed2
1 changed files with 4 additions and 2 deletions
6
map.html
6
map.html
|
@ -85,8 +85,8 @@
|
|||
socket.on("setName", function(data){
|
||||
console.log("setName", data);
|
||||
names[data.id] = data.name;
|
||||
//if(data.id in markers)
|
||||
// markers[data.id].setIcon(icons[data.color]);
|
||||
if(data.id in markers)
|
||||
markers[data.id].bindPopup(data.name);
|
||||
});
|
||||
|
||||
socket.on("changeColor", function(data){
|
||||
|
@ -111,6 +111,8 @@
|
|||
else
|
||||
icon = icons[colors[data.id]];
|
||||
markers[data.id] = L.marker(data.position, {"icon": icon}).addTo(map);
|
||||
if(data.id in names)
|
||||
markers[data.id].bindPopup(names[data.id]);
|
||||
} else{
|
||||
markers[data.id].setLatLng(data.position);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue