fini self-icons

This commit is contained in:
Sylvain Gay 2023-09-06 18:13:40 +02:00
parent d135dd41e2
commit ecdcd7e545
4 changed files with 13 additions and 7 deletions

View file

@ -83,7 +83,7 @@
socket = io({rejectUnauthorized: false, auth: {type:"Admin"}}); socket = io({rejectUnauthorized: false, auth: {type:"Admin"}});
setup_socket_common(-1); setup_socket_common();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// INTERACTION // INTERACTION

View file

@ -45,7 +45,7 @@
id = "%ID"; // %ID will be replaced by the real id. id = "%ID"; // %ID will be replaced by the real id.
socket = io({rejectUnauthorized: false, auth: {id: id, type:"conscrit"}}); socket = io({rejectUnauthorized: false, auth: {id: id, type:"conscrit"}});
setup_socket_common(id); setup_socket_common();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// SETTINGS -- CODE // SETTINGS -- CODE

View file

@ -65,7 +65,7 @@
id = "%ID"; // %ID will be replaced by the real id. id = "%ID"; // %ID will be replaced by the real id.
socket = io({rejectUnauthorized: false, auth: {id: id, type:"vieux"}}); socket = io({rejectUnauthorized: false, auth: {id: id, type:"vieux"}});
setup_socket_common(id); setup_socket_common();
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// SETTINGS -- State // SETTINGS -- State

View file

@ -72,12 +72,18 @@ function setup_socket_common(){
socket.on("moving", function(data){ socket.on("moving", function(data){
console.log("moving", data); console.log("moving", data);
if(!(data.id in markers)){ if(!(data.id in markers)){
markers[data.id] = L.marker(data.position, {"icon": icons[data.color]}).addTo(map); if(data.id == id){
if(data.id == id) markers[data.id] = L.marker(data.position, {"icon": self_icons[data.color]}).addTo(map);
markers[data.id].setZIndexOffset(10000); markers[data.id].setZIndexOffset(10000);
}
else
markers[data.id] = L.marker(data.position, {"icon": icons[data.color]}).addTo(map);
markers[data.id].bindPopup(data.id); markers[data.id].bindPopup(data.id);
} else{ } else{
markers[data.id].setLatLng(data.position); markers[data.id].setLatLng(data.position);
if(data.id == id)
markers[data.id].setIcon(self_icons[data.color]);
else
markers[data.id].setIcon(icons[data.color]); markers[data.id].setIcon(icons[data.color]);
} }
}); });