From c3891f44b963917fbd0900e259f036a1b03540a5 Mon Sep 17 00:00:00 2001 From: Anton Sarukhanov <code@ant.sr> Date: Wed, 3 Feb 2016 19:00:28 -0500 Subject: [PATCH] Prevent glitches while moving the map. Also do a better job at removing stale markers. --- static/css/map.css | 2 ++ static/js/map.js | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/static/css/map.css b/static/css/map.css index 8875f35..5680d42 100644 --- a/static/css/map.css +++ b/static/css/map.css @@ -26,6 +26,7 @@ html, body { position: absolute; bottom: 10px; left: 10px; + z-index: 5000; } #locate a { text-decoration: none; @@ -75,6 +76,7 @@ html, body { border-left: 1px solid #eee; border-top-left-radius: 3px; color: #eee; + z-index: 5000; } #map .leaflet-control-zoom, #map .leaflet-control-zoom a { diff --git a/static/js/map.js b/static/js/map.js index 621909e..d8a1ecb 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -32,8 +32,6 @@ BusMap.Map = function(opts) { // Go to view requested by URL hash (if set) var viewOk = that.setViewFromUrlHash(); - // And watch for updates - $(window).bind('hashchange', that.setViewFromUrlHash); if (!viewOk) { // Restore the user's last view (if exists). @@ -208,6 +206,7 @@ BusMap.Map = function(opts) { for (v in that.vehicleMarkers) { var min_updated = Date.now() - (that.vehicleMaxAge * 1000) if (that.vehicleMarkers[v].bm_updated < min_updated) { + that.leaflet.removeLayer(that.vehicleMarkers[v]); delete that.vehicleMarkers[v]; } } -- GitLab