diff --git a/js/app.js b/js/app.js index 3d7c284..30bb1a6 100644 --- a/js/app.js +++ b/js/app.js @@ -108,7 +108,7 @@ function load_hash(no_refresh) { manual_pan = true; v = v.split(','); var latlng = new L.LatLng(v[0], v[1]); - map.setView(latlng); + map.panTo(latlng); break; case "f": refocus = (follow_vehicle != v); diff --git a/js/tracker.js b/js/tracker.js index 9f2eb0d..e6a1379 100644 --- a/js/tracker.js +++ b/js/tracker.js @@ -389,11 +389,14 @@ function load() { map = new L.map(document.getElementById('map'), { zoom: 5, zoomControl: false, - center: [53.467511,-2.2338940], + zoomAnimationThreshold: 0, + center: [53.467511,-2.233894], layers: [osm], preferCanvas: true, }); + map.setView([53.467511,-2.233894], 5, {animate: false}); + // fullscreen button map.addControl(new L.Control.Fullscreen({ position: 'bottomleft' })); @@ -428,6 +431,27 @@ function load() { L.control.status({ position: 'bottomright' }).addTo(map); + L.Control.PeriodControl = L.Control.extend({ + onAdd: function(map) { + var div = L.DomUtil.create('div'); + + div.innerHTML = ''; + div.innerHTML.onload = setTimeValue(); + + return div; + }, + + onRemove: function(map) { + // Nothing to do here + } + }); + + L.control.periodcontrol = function(opts) { + return new L.Control.PeriodControl(opts); + } + + L.control.periodcontrol({ position: 'topleft' }).addTo(map); + // update current position if we geolocation is available if(currentPosition) updateCurrentPosition(currentPosition.lat, currentPosition.lon); @@ -494,29 +518,9 @@ function load() { // only start population the map, once its completely loaded var callBack = function() { load_hash(null); + map.options.zoomAnimationThreshold = 4; - L.Control.PeriodControl = L.Control.extend({ - onAdd: function(map) { - var div = L.DomUtil.create('div'); - - div.innerHTML = ''; - div.innerHTML.onload = setTimeValue(); - - return div; - }, - - onRemove: function(map) { - // Nothing to do here - } - }); - - L.control.periodcontrol = function(opts) { - return new L.Control.PeriodControl(opts); - } - - L.control.periodcontrol({ position: 'topleft' }).addTo(map); - - map.on('idle', function() { + map.on('moveend', function() { lhash_update(); }); map.on('baselayerchange', function() { @@ -2628,12 +2632,6 @@ function refresh() { periodical = setTimeout(refresh, 2000); return; } - - if (ajax_inprogress_old == wvar.query) { - if (vehicles.hasOwnProperty(wvar.query)) { - return; - } - } if (ajax_inprogress_old != wvar.query) { document.getElementById("timeperiod").disabled = false;