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"}});
setup_socket_common(-1);
setup_socket_common();
//////////////////////////////////////////////////////////////////////////////
// INTERACTION

View file

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

View file

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

View file

@ -72,13 +72,19 @@ function setup_socket_common(){
socket.on("moving", function(data){
console.log("moving", data);
if(!(data.id in markers)){
markers[data.id] = L.marker(data.position, {"icon": icons[data.color]}).addTo(map);
if(data.id == id)
markers[data.id].setZIndexOffset(10000);
if(data.id == id){
markers[data.id] = L.marker(data.position, {"icon": self_icons[data.color]}).addTo(map);
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);
} else{
markers[data.id].setLatLng(data.position);
markers[data.id].setIcon(icons[data.color]);
if(data.id == id)
markers[data.id].setIcon(self_icons[data.color]);
else
markers[data.id].setIcon(icons[data.color]);
}
});