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

View file

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

View file

@ -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(){

View file

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

View file

@ -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;