Skip to content

Commit cbeb5cf

Browse files
authored
Merge pull request #36 from LukePrior/revert-35-testing
Revert change
2 parents bff8427 + 062b345 commit cbeb5cf

File tree

2 files changed

+43
-33
lines changed

2 files changed

+43
-33
lines changed

js/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ function lhash_update(history_step) {
1414

1515
// generate hash
1616
hash += "mt=" + selectedLayer;
17-
hash += "&mz=" + roundNumber(map.getZoom(),0);
17+
hash += "&mz=" + map.getZoom();
1818

1919
if(!/^[a-z0-9]{32}$/ig.exec(wvar.query)) {
2020
hash += "&qm=" + wvar.mode.replace(/ /g, '_');
2121
}
2222

2323
if(follow_vehicle === null || manual_pan) {
2424
var latlng = map.getCenter();
25-
hash += "&mc=" + roundNumber(latlng.lat, 5) + "," + roundNumber(latlng.lng, 5);
25+
hash += "&mc=" + roundNumber(latlng.lat, 5) +
26+
"," + roundNumber(latlng.lng, 5);
2627
}
2728

2829
if(follow_vehicle !== null) {
@@ -107,7 +108,7 @@ function load_hash(no_refresh) {
107108
manual_pan = true;
108109
v = v.split(',');
109110
var latlng = new L.LatLng(v[0], v[1]);
110-
map.panTo(latlng, {animate: false});
111+
map.setView(latlng);
111112
break;
112113
case "f":
113114
refocus = (follow_vehicle != v);

js/tracker.js

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -428,27 +428,6 @@ function load() {
428428

429429
L.control.status({ position: 'bottomright' }).addTo(map);
430430

431-
L.Control.PeriodControl = L.Control.extend({
432-
onAdd: function(map) {
433-
var div = L.DomUtil.create('div');
434-
435-
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>';
436-
div.innerHTML.onload = setTimeValue();
437-
438-
return div;
439-
},
440-
441-
onRemove: function(map) {
442-
// Nothing to do here
443-
}
444-
});
445-
446-
L.control.periodcontrol = function(opts) {
447-
return new L.Control.PeriodControl(opts);
448-
}
449-
450-
L.control.periodcontrol({ position: 'topleft' }).addTo(map);
451-
452431
// update current position if we geolocation is available
453432
if(currentPosition) updateCurrentPosition(currentPosition.lat, currentPosition.lon);
454433

@@ -470,7 +449,15 @@ function load() {
470449
showLaunchSites();
471450
map.addLayer(launches);
472451
}
473-
452+
453+
map.on('moveend', function (e) {
454+
lhash_update();
455+
});
456+
457+
map.on('baselayerchange', function (e) {
458+
selectedLayer = e.layer.id;
459+
});
460+
474461
map.on('zoomend', function() {
475462
//do check for horizon labels
476463
if (!offline.get("opt_hide_horizon")) {
@@ -504,20 +491,42 @@ function load() {
504491
if(!wvar.embeded) manual_pan = true;
505492
});
506493

507-
map.once('move', function() {
494+
// only start population the map, once its completely loaded
495+
var callBack = function() {
508496
load_hash(null);
509497

510-
map.on('moveend', function() {
511-
lhash_update();
512-
});
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();
513504

514-
map.on('baselayerchange', function(e) {
515-
selectedLayer = e.layer.id;
516-
lhash_update();
505+
return div;
506+
},
507+
508+
onRemove: function(map) {
509+
// Nothing to do here
510+
}
517511
});
512+
513+
L.control.periodcontrol = function(opts) {
514+
return new L.Control.PeriodControl(opts);
515+
}
518516

517+
L.control.periodcontrol({ position: 'topleft' }).addTo(map);
518+
519+
map.on('idle', function() {
520+
lhash_update();
521+
});
522+
map.on('baselayerchange', function() {
523+
lhash_update();
524+
});
525+
519526
startAjax();
520-
});
527+
};
528+
529+
map.whenReady(callBack);
521530

522531
// animate-in the timebox,
523532
setTimeout(function() {

0 commit comments

Comments
 (0)