Fix initial map centering thinkos.
This commit is contained in:
parent
94f62e5b5f
commit
35e5088529
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,4 +1,4 @@
|
|||
dump1090-mutability (1.10.3010.14mu-10) UNRELEASED; urgency=medium
|
||||
dump1090-mutability (1.10.3010.14mu-10) unstable; urgency=medium
|
||||
|
||||
* Many changes to aircraft.json and the webserver code:
|
||||
|
||||
|
@ -49,7 +49,9 @@ dump1090-mutability (1.10.3010.14mu-10) UNRELEASED; urgency=medium
|
|||
* Remove extension.js and options.js, as they aren't really maintained.
|
||||
* Enable strict mode for script.js / planeObject.js.
|
||||
|
||||
-- Oliver Jowett <oliver@mutability.co.uk> Mon, 05 Jan 2015 21:43:58 +0000
|
||||
* Fix initial map centering to correctly use the receiver location.
|
||||
|
||||
-- Oliver Jowett <oliver@mutability.co.uk> Wed, 07 Jan 2015 23:54:10 +0000
|
||||
|
||||
dump1090-mutability (1.10.3010.14mu-9) unstable; urgency=medium
|
||||
|
||||
|
|
|
@ -13,9 +13,11 @@ var SpecialSquawks = {
|
|||
};
|
||||
|
||||
// Get current map settings
|
||||
var CenterLat = Number(localStorage['CenterLat']) || CONST_CENTERLAT;
|
||||
var CenterLon = Number(localStorage['CenterLon']) || CONST_CENTERLON;
|
||||
var ZoomLvl = Number(localStorage['ZoomLvl']) || CONST_ZOOMLVL;
|
||||
var DefaultCenterLat = CONST_CENTERLAT;
|
||||
var DefaultCenterLon = CONST_CENTERLON;
|
||||
var DefaultZoomLvl = CONST_ZOOMLVL;
|
||||
|
||||
var CenterLat, CenterLon, ZoomLvl;
|
||||
|
||||
var Dump1090Version = "unknown version";
|
||||
var RefreshInterval = 1000;
|
||||
|
@ -147,8 +149,8 @@ function initialize() {
|
|||
SiteShow = true;
|
||||
SiteLat = data.lat;
|
||||
SiteLon = data.lon;
|
||||
CONST_CENTERLAT = data.lat;
|
||||
CONST_CENTERLON = data.lon;
|
||||
DefaultCenterLat = data.lat;
|
||||
DefaultCenterLon = data.lon;
|
||||
}
|
||||
|
||||
Dump1090Version = data.version;
|
||||
|
@ -159,8 +161,12 @@ function initialize() {
|
|||
|
||||
// Initalizes the map and starts up our timers to call various functions
|
||||
function initialize_after_config() {
|
||||
// Set SitePosition, initialize sorting
|
||||
// Load stored map settings if present
|
||||
CenterLat = Number(localStorage['CenterLat']) || DefaultCenterLat;
|
||||
CenterLon = Number(localStorage['CenterLon']) || DefaultCenterLon;
|
||||
ZoomLvl = Number(localStorage['ZoomLvl']) || DefaultZoomLvl;
|
||||
|
||||
// Set SitePosition, initialize sorting
|
||||
if (SiteShow && (typeof SiteLat !== 'undefined') && (typeof SiteLon !== 'undefined')) {
|
||||
SitePosition = new google.maps.LatLng(SiteLat, SiteLon);
|
||||
sortByDistance();
|
||||
|
@ -685,26 +691,16 @@ function selectPlaneByHex(hex) {
|
|||
}
|
||||
|
||||
function resetMap() {
|
||||
// Reset localStorage values
|
||||
localStorage['CenterLat'] = CONST_CENTERLAT;
|
||||
localStorage['CenterLon'] = CONST_CENTERLON;
|
||||
localStorage['ZoomLvl'] = CONST_ZOOMLVL;
|
||||
|
||||
// Try to read values from localStorage else use CONST_s
|
||||
CenterLat = Number(localStorage['CenterLat']) || CONST_CENTERLAT;
|
||||
CenterLon = Number(localStorage['CenterLon']) || CONST_CENTERLON;
|
||||
ZoomLvl = Number(localStorage['ZoomLvl']) || CONST_ZOOMLVL;
|
||||
|
||||
// Set and refresh
|
||||
GoogleMap.setZoom(parseInt(ZoomLvl));
|
||||
GoogleMap.setCenter(new google.maps.LatLng(parseFloat(CenterLat), parseFloat(CenterLon)));
|
||||
|
||||
if (SelectedPlane) {
|
||||
selectPlaneByHex(SelectedPlane);
|
||||
}
|
||||
// Reset localStorage values and map settings
|
||||
localStorage['CenterLat'] = CenterLat = DefaultCenterLat;
|
||||
localStorage['CenterLon'] = CenterLon = DefaultCenterLon;
|
||||
localStorage['ZoomLvl'] = ZoomLvl = DefaultZoomLvl;
|
||||
|
||||
refreshSelected();
|
||||
refreshTableInfo();
|
||||
// Set and refresh
|
||||
GoogleMap.setZoom(ZoomLvl);
|
||||
GoogleMap.setCenter(new google.maps.LatLng(CenterLat, CenterLon));
|
||||
|
||||
selectPlaneByHex(null);
|
||||
}
|
||||
|
||||
function drawCircle(marker, distance) {
|
||||
|
|
Loading…
Reference in a new issue