Skip to content
Snippets Groups Projects
Commit c3891f44 authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Prevent glitches while moving the map. Also do a better job at removing stale markers.

parent 1e09f3a9
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ html, body { ...@@ -26,6 +26,7 @@ html, body {
position: absolute; position: absolute;
bottom: 10px; bottom: 10px;
left: 10px; left: 10px;
z-index: 5000;
} }
#locate a { #locate a {
text-decoration: none; text-decoration: none;
...@@ -75,6 +76,7 @@ html, body { ...@@ -75,6 +76,7 @@ html, body {
border-left: 1px solid #eee; border-left: 1px solid #eee;
border-top-left-radius: 3px; border-top-left-radius: 3px;
color: #eee; color: #eee;
z-index: 5000;
} }
#map .leaflet-control-zoom, #map .leaflet-control-zoom,
#map .leaflet-control-zoom a { #map .leaflet-control-zoom a {
......
...@@ -32,8 +32,6 @@ BusMap.Map = function(opts) { ...@@ -32,8 +32,6 @@ BusMap.Map = function(opts) {
// Go to view requested by URL hash (if set) // Go to view requested by URL hash (if set)
var viewOk = that.setViewFromUrlHash(); var viewOk = that.setViewFromUrlHash();
// And watch for updates
$(window).bind('hashchange', that.setViewFromUrlHash);
if (!viewOk) { if (!viewOk) {
// Restore the user's last view (if exists). // Restore the user's last view (if exists).
...@@ -208,6 +206,7 @@ BusMap.Map = function(opts) { ...@@ -208,6 +206,7 @@ BusMap.Map = function(opts) {
for (v in that.vehicleMarkers) { for (v in that.vehicleMarkers) {
var min_updated = Date.now() - (that.vehicleMaxAge * 1000) var min_updated = Date.now() - (that.vehicleMaxAge * 1000)
if (that.vehicleMarkers[v].bm_updated < min_updated) { if (that.vehicleMarkers[v].bm_updated < min_updated) {
that.leaflet.removeLayer(that.vehicleMarkers[v]);
delete that.vehicleMarkers[v]; delete that.vehicleMarkers[v];
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment