From 4f4fed8ea7982818aed6b570f2726ad91deb8d3b Mon Sep 17 00:00:00 2001 From: Sylvain Gay Date: Wed, 14 Sep 2022 14:45:51 +0200 Subject: [PATCH] =?UTF-8?q?ajout=C3=A9=20faux=20traqueurs,=20redimensionn?= =?UTF-8?q?=C3=A9=20map?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/admin.html | 6 +++++- static/conscrit.html | 3 +-- static/utils.js | 4 ++++ static/vieilleux.html | 2 +- traque.js | 4 ++++ 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/static/admin.html b/static/admin.html index 7e62780..7403b81 100644 --- a/static/admin.html +++ b/static/admin.html @@ -17,7 +17,7 @@ @@ -33,6 +33,10 @@ setup_map(); + map.on("dblclick", function(data){ + socket.emit("newTracker", {"position": [data.latlng.lat, data.latlng.lng]}); + }); + ////////////////////////////////////////////////////////////////////////////// // UPDATE MAP diff --git a/static/conscrit.html b/static/conscrit.html index ae810db..29f3510 100644 --- a/static/conscrit.html +++ b/static/conscrit.html @@ -17,7 +17,7 @@ @@ -40,7 +40,6 @@ setup_socket_not_admin(); setup_socket_common(); - ////////////////////////////////////////////////////////////////////////////// // SETTINGS -- NAME AND COLOR diff --git a/static/utils.js b/static/utils.js index 6078e13..76aad4c 100644 --- a/static/utils.js +++ b/static/utils.js @@ -96,6 +96,10 @@ function setup_socket_common(){ if(data.id in markers) markers[data.id].remove(); }); + + socket.on("newTracker", function(data){ + L.marker(data.position, {"icon": icons[1]}).addTo(map); + }); } function setup_socket_not_admin(){ diff --git a/static/vieilleux.html b/static/vieilleux.html index 5804e2e..ad864ab 100644 --- a/static/vieilleux.html +++ b/static/vieilleux.html @@ -17,7 +17,7 @@ diff --git a/traque.js b/traque.js index 31bd09f..17e6dc2 100644 --- a/traque.js +++ b/traque.js @@ -81,6 +81,10 @@ io.sockets.on('connection', function(socket){ admins.push(socket); for(i in equipes) equipes[i].emit('changeColor', {"id": socket.id, "color": -1}); + socket.on('newTracker', function(d){ + for(i in equipes) + equipes[i].emit('newTracker', d); + }); }); socket.on('geoLoc', function(d){ socket.position = d.position;