solved #8
This commit is contained in:
parent
b0ccf9284d
commit
2d229fc7bc
4 changed files with 12 additions and 18 deletions
|
@ -57,7 +57,7 @@
|
||||||
markers[data.id].setOpacity(0);
|
markers[data.id].setOpacity(0);
|
||||||
else
|
else
|
||||||
if(data.color == -1)
|
if(data.color == -1)
|
||||||
markers[data.id].setIcon(icon_invisible);
|
markers[data.id].setIcon(self_invisible);
|
||||||
else
|
else
|
||||||
markers[data.id].setIcon(icons[data.color]);
|
markers[data.id].setIcon(icons[data.color]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<div id="map"></div><br/>
|
<div id="map"></div><br/>
|
||||||
|
|
||||||
<input id="name"/><button id="setName">Set team name</button><br/>
|
<input id="name"/><button id="setName">Set team name</button><br/>
|
||||||
<input id="message"/><button id="sendMessage">Send message to base</button><br/>
|
<input id="message"/><button id="sendMessage">Enter code</button><br/>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -13,19 +13,13 @@ var icons = [
|
||||||
iconUrl: 'def.png',
|
iconUrl: 'def.png',
|
||||||
iconSize: [10, 10],
|
iconSize: [10, 10],
|
||||||
iconAnchor: [5, 5],
|
iconAnchor: [5, 5],
|
||||||
popupAnchor: [5, 5],
|
popupAnchor: [5, 5]
|
||||||
//shadowUrl: 'my-icon-shadow.png',
|
|
||||||
//shadowSize: [68, 95],
|
|
||||||
//shadowAnchor: [22, 94]
|
|
||||||
}),
|
}),
|
||||||
L.icon({
|
L.icon({
|
||||||
iconUrl: 'track.png',
|
iconUrl: 'track.png',
|
||||||
iconSize: [10, 10],
|
iconSize: [10, 10],
|
||||||
iconAnchor: [5, 5],
|
iconAnchor: [5, 5],
|
||||||
popupAnchor: [5, 5],
|
popupAnchor: [5, 5]
|
||||||
//shadowUrl: 'my-icon-shadow.png',
|
|
||||||
//shadowSize: [68, 95],
|
|
||||||
//shadowAnchor: [22, 94]
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
var self_icons = icons;
|
var self_icons = icons;
|
||||||
|
@ -34,10 +28,7 @@ var self_invisible =
|
||||||
iconUrl: 'invi.png',
|
iconUrl: 'invi.png',
|
||||||
iconSize: [10, 10],
|
iconSize: [10, 10],
|
||||||
iconAnchor: [5, 5],
|
iconAnchor: [5, 5],
|
||||||
popupAnchor: [5, 5],
|
popupAnchor: [5, 5]
|
||||||
//shadowUrl: 'my-icon-shadow.png',
|
|
||||||
//shadowSize: [68, 95],
|
|
||||||
//shadowAnchor: [22, 94]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -48,7 +39,7 @@ var map;
|
||||||
function setup_map(){
|
function setup_map(){
|
||||||
map = L.map('map').setView([48.8448, 2.3550], 13);
|
map = L.map('map').setView([48.8448, 2.3550], 13);
|
||||||
|
|
||||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
L.tileLayer('https://stamen-tiles.a.ssl.fastly.net/toner/{z}/{x}/{y}.png', {
|
||||||
maxZoom: 19,
|
maxZoom: 19,
|
||||||
attribution: '© OpenStreetMap'
|
attribution: '© OpenStreetMap'
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
@ -88,6 +79,11 @@ function setup_socket_common(){
|
||||||
if(data.id in markers)
|
if(data.id in markers)
|
||||||
markers[data.id].bindPopup(data.name);
|
markers[data.id].bindPopup(data.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on("remove", function(data){
|
||||||
|
if(data.id in markers)
|
||||||
|
markers[data.id].remove();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_socket_not_admin(){
|
function setup_socket_not_admin(){
|
||||||
|
|
|
@ -143,10 +143,8 @@ io.sockets.on('connection', function(socket){
|
||||||
equipes[i].emit('setName', {"id": socket.id, "name": d.name});
|
equipes[i].emit('setName', {"id": socket.id, "name": d.name});
|
||||||
});
|
});
|
||||||
socket.on("disconnect", function(_){
|
socket.on("disconnect", function(_){
|
||||||
socket.shown = false;
|
|
||||||
socket.color = -1;
|
|
||||||
for(i in equipes)
|
for(i in equipes)
|
||||||
equipes[i].emit('changeColor', {"id": socket.id, "color": -1});
|
equipes[i].emit('remove', {"id": socket.id});
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.emit('yourId', {"id": socket.id});
|
socket.emit('yourId', {"id": socket.id});
|
||||||
|
|
Loading…
Reference in a new issue