From 385d5a091dcb952084f8e13447f7a0cfc3b8e12c Mon Sep 17 00:00:00 2001 From: wgaylord Date: Wed, 24 Oct 2018 15:58:38 -0500 Subject: [PATCH] Fix line bugs in the map --- templates/map.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/map.html b/templates/map.html index 3fc4e58..600b95d 100644 --- a/templates/map.html +++ b/templates/map.html @@ -36,8 +36,8 @@ var sat = L.icon({ var station = L.icon({ iconUrl: 'static/station-marker.png', - iconSize: [5, 5], - iconAnchor: [2, 2], + iconSize: [10, 10], + iconAnchor: [5, 5], popupAnchor: [0, 0], }); @@ -88,8 +88,9 @@ $.get("/api/satstationpairs", function(data, status){ firstpolyline = new L.Polyline([[stationList[entry[0]]._latlng.lat,stationList[entry[0]]._latlng.lng],[sats[entry[1]]._latlng.lat,sats[entry[1]]._latlng.lng]], {color: 'red',weight: 3,opacity: 1,smoothFactor: 1}); firstpolyline.addTo(mymap) firstpolyline.bringToFront() - links[entry[1]] = firstpolyline + links[entry[0]] = firstpolyline stationList[entry[0]].setIcon(active_station) + stationList[entry[0]].setZIndexOffset(500) }); }); @@ -100,10 +101,10 @@ setInterval(function(){ links[key].setStyle({opacity:0}) links[key].removeFrom(mymap) - delete links[key] }) + + links = {} - @@ -128,18 +129,20 @@ setInterval(function(){ var usedStations = [] Object.keys(stationList).forEach(function(key){ stationList[key].setIcon(station) + stationList[key].setZIndexOffset(-1000) }) data.forEach(function(entry){ firstpolyline = new L.Polyline([[stationList[entry[0]]._latlng.lat,stationList[entry[0]]._latlng.lng],[sats[entry[1]]._latlng.lat,sats[entry[1]]._latlng.lng]], {color: 'red',weight:3,opacity:1,smoothFactor: 1}); firstpolyline.addTo(mymap) - links[entry[1]] = firstpolyline + links[entry[0]] = firstpolyline stationList[entry[0]].setIcon(active_station) + stationList[entry[0]].setZIndexOffset(500) }); }); console.log(links) - }, 10000); + }, 20000); \ No newline at end of file