From 4b10f28ed2d108dcc3c4ed92df5707da5dbdd469 Mon Sep 17 00:00:00 2001 From: Sylvain Gay Date: Fri, 9 Sep 2022 17:10:14 +0200 Subject: [PATCH] =?UTF-8?q?ajout=C3=A9=20popups?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- map.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/map.html b/map.html index 00c9a4a..e8c5c5d 100644 --- a/map.html +++ b/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); }