ajouté faux traqueurs, redimensionné map

This commit is contained in:
Sylvain Gay 2022-09-14 14:45:51 +02:00
parent 99914c621a
commit 4f4fed8ea7
5 changed files with 15 additions and 4 deletions

View file

@ -17,7 +17,7 @@
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<style type="text/css"> <style type="text/css">
#map { height: 500px; } #map { height: 750px; }
</style> </style>
<script type="text/javascript" src="utils.js"></script> <script type="text/javascript" src="utils.js"></script>
@ -33,6 +33,10 @@
setup_map(); setup_map();
map.on("dblclick", function(data){
socket.emit("newTracker", {"position": [data.latlng.lat, data.latlng.lng]});
});
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// UPDATE MAP // UPDATE MAP

View file

@ -17,7 +17,7 @@
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<style type="text/css"> <style type="text/css">
#map { height: 500px; } #map { height: 600px; }
</style> </style>
<script type="text/javascript" src="utils.js"></script> <script type="text/javascript" src="utils.js"></script>
@ -40,7 +40,6 @@
setup_socket_not_admin(); setup_socket_not_admin();
setup_socket_common(); setup_socket_common();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// SETTINGS -- NAME AND COLOR // SETTINGS -- NAME AND COLOR

View file

@ -96,6 +96,10 @@ function setup_socket_common(){
if(data.id in markers) if(data.id in markers)
markers[data.id].remove(); markers[data.id].remove();
}); });
socket.on("newTracker", function(data){
L.marker(data.position, {"icon": icons[1]}).addTo(map);
});
} }
function setup_socket_not_admin(){ function setup_socket_not_admin(){

View file

@ -17,7 +17,7 @@
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<style type="text/css"> <style type="text/css">
#map { height: 500px; } #map { height: 600px; }
</style> </style>
<script type="text/javascript" src="utils.js"></script> <script type="text/javascript" src="utils.js"></script>

View file

@ -81,6 +81,10 @@ io.sockets.on('connection', function(socket){
admins.push(socket); admins.push(socket);
for(i in equipes) for(i in equipes)
equipes[i].emit('changeColor', {"id": socket.id, "color": -1}); 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.on('geoLoc', function(d){
socket.position = d.position; socket.position = d.position;