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;