Skip to content

Commit 71b60c8

Browse files
authored
Merge pull request projecthorus#37 from LukePrior/testing
Fix attempt
2 parents 10f8a27 + dc33015 commit 71b60c8

File tree

2 files changed

+28
-30
lines changed

2 files changed

+28
-30
lines changed

js/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function load_hash(no_refresh) {
108108
manual_pan = true;
109109
v = v.split(',');
110110
var latlng = new L.LatLng(v[0], v[1]);
111-
map.setView(latlng);
111+
map.panTo(latlng);
112112
break;
113113
case "f":
114114
refocus = (follow_vehicle != v);

js/tracker.js

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -389,11 +389,14 @@ function load() {
389389
map = new L.map(document.getElementById('map'), {
390390
zoom: 5,
391391
zoomControl: false,
392-
center: [53.467511,-2.2338940],
392+
zoomAnimationThreshold: 0,
393+
center: [53.467511,-2.233894],
393394
layers: [osm],
394395
preferCanvas: true,
395396
});
396397

398+
map.setView([53.467511,-2.233894], 5, {animate: false});
399+
397400
// fullscreen button
398401
map.addControl(new L.Control.Fullscreen({ position: 'bottomleft' }));
399402

@@ -428,6 +431,27 @@ function load() {
428431

429432
L.control.status({ position: 'bottomright' }).addTo(map);
430433

434+
L.Control.PeriodControl = L.Control.extend({
435+
onAdd: function(map) {
436+
var div = L.DomUtil.create('div');
437+
438+
div.innerHTML = '<select name="timeperiod" id="timeperiod" style="width:auto !important;height:30px;" onchange="clean_refresh(this.value)"><option value="1 hour">1 hour</option><option value="3 hours" selected="selected">3 hours</option><option value="6 hours">6 hours</option><option value="12 hours">12 hours</option></select>';
439+
div.innerHTML.onload = setTimeValue();
440+
441+
return div;
442+
},
443+
444+
onRemove: function(map) {
445+
// Nothing to do here
446+
}
447+
});
448+
449+
L.control.periodcontrol = function(opts) {
450+
return new L.Control.PeriodControl(opts);
451+
}
452+
453+
L.control.periodcontrol({ position: 'topleft' }).addTo(map);
454+
431455
// update current position if we geolocation is available
432456
if(currentPosition) updateCurrentPosition(currentPosition.lat, currentPosition.lon);
433457

@@ -494,29 +518,9 @@ function load() {
494518
// only start population the map, once its completely loaded
495519
var callBack = function() {
496520
load_hash(null);
521+
map.options.zoomAnimationThreshold = 4;
497522

498-
L.Control.PeriodControl = L.Control.extend({
499-
onAdd: function(map) {
500-
var div = L.DomUtil.create('div');
501-
502-
div.innerHTML = '<select name="timeperiod" id="timeperiod" style="width:auto !important;height:30px;" onchange="clean_refresh(this.value)"><option value="1 hour">1 hour</option><option value="3 hours" selected="selected">3 hours</option><option value="6 hours">6 hours</option><option value="12 hours">12 hours</option></select>';
503-
div.innerHTML.onload = setTimeValue();
504-
505-
return div;
506-
},
507-
508-
onRemove: function(map) {
509-
// Nothing to do here
510-
}
511-
});
512-
513-
L.control.periodcontrol = function(opts) {
514-
return new L.Control.PeriodControl(opts);
515-
}
516-
517-
L.control.periodcontrol({ position: 'topleft' }).addTo(map);
518-
519-
map.on('idle', function() {
523+
map.on('moveend', function() {
520524
lhash_update();
521525
});
522526
map.on('baselayerchange', function() {
@@ -2628,12 +2632,6 @@ function refresh() {
26282632
periodical = setTimeout(refresh, 2000);
26292633
return;
26302634
}
2631-
2632-
if (ajax_inprogress_old == wvar.query) {
2633-
if (vehicles.hasOwnProperty(wvar.query)) {
2634-
return;
2635-
}
2636-
}
26372635

26382636
if (ajax_inprogress_old != wvar.query) {
26392637
document.getElementById("timeperiod").disabled = false;

0 commit comments

Comments
 (0)