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:
|
* 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.
|
* Remove extension.js and options.js, as they aren't really maintained.
|
||||||
* Enable strict mode for script.js / planeObject.js.
|
* 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
|
dump1090-mutability (1.10.3010.14mu-9) unstable; urgency=medium
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,11 @@ var SpecialSquawks = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get current map settings
|
// Get current map settings
|
||||||
var CenterLat = Number(localStorage['CenterLat']) || CONST_CENTERLAT;
|
var DefaultCenterLat = CONST_CENTERLAT;
|
||||||
var CenterLon = Number(localStorage['CenterLon']) || CONST_CENTERLON;
|
var DefaultCenterLon = CONST_CENTERLON;
|
||||||
var ZoomLvl = Number(localStorage['ZoomLvl']) || CONST_ZOOMLVL;
|
var DefaultZoomLvl = CONST_ZOOMLVL;
|
||||||
|
|
||||||
|
var CenterLat, CenterLon, ZoomLvl;
|
||||||
|
|
||||||
var Dump1090Version = "unknown version";
|
var Dump1090Version = "unknown version";
|
||||||
var RefreshInterval = 1000;
|
var RefreshInterval = 1000;
|
||||||
|
@ -147,8 +149,8 @@ function initialize() {
|
||||||
SiteShow = true;
|
SiteShow = true;
|
||||||
SiteLat = data.lat;
|
SiteLat = data.lat;
|
||||||
SiteLon = data.lon;
|
SiteLon = data.lon;
|
||||||
CONST_CENTERLAT = data.lat;
|
DefaultCenterLat = data.lat;
|
||||||
CONST_CENTERLON = data.lon;
|
DefaultCenterLon = data.lon;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dump1090Version = data.version;
|
Dump1090Version = data.version;
|
||||||
|
@ -159,8 +161,12 @@ function initialize() {
|
||||||
|
|
||||||
// Initalizes the map and starts up our timers to call various functions
|
// Initalizes the map and starts up our timers to call various functions
|
||||||
function initialize_after_config() {
|
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')) {
|
if (SiteShow && (typeof SiteLat !== 'undefined') && (typeof SiteLon !== 'undefined')) {
|
||||||
SitePosition = new google.maps.LatLng(SiteLat, SiteLon);
|
SitePosition = new google.maps.LatLng(SiteLat, SiteLon);
|
||||||
sortByDistance();
|
sortByDistance();
|
||||||
|
@ -685,26 +691,16 @@ function selectPlaneByHex(hex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetMap() {
|
function resetMap() {
|
||||||
// Reset localStorage values
|
// Reset localStorage values and map settings
|
||||||
localStorage['CenterLat'] = CONST_CENTERLAT;
|
localStorage['CenterLat'] = CenterLat = DefaultCenterLat;
|
||||||
localStorage['CenterLon'] = CONST_CENTERLON;
|
localStorage['CenterLon'] = CenterLon = DefaultCenterLon;
|
||||||
localStorage['ZoomLvl'] = CONST_ZOOMLVL;
|
localStorage['ZoomLvl'] = ZoomLvl = DefaultZoomLvl;
|
||||||
|
|
||||||
// Try to read values from localStorage else use CONST_s
|
// Set and refresh
|
||||||
CenterLat = Number(localStorage['CenterLat']) || CONST_CENTERLAT;
|
GoogleMap.setZoom(ZoomLvl);
|
||||||
CenterLon = Number(localStorage['CenterLon']) || CONST_CENTERLON;
|
GoogleMap.setCenter(new google.maps.LatLng(CenterLat, CenterLon));
|
||||||
ZoomLvl = Number(localStorage['ZoomLvl']) || CONST_ZOOMLVL;
|
|
||||||
|
|
||||||
// Set and refresh
|
selectPlaneByHex(null);
|
||||||
GoogleMap.setZoom(parseInt(ZoomLvl));
|
|
||||||
GoogleMap.setCenter(new google.maps.LatLng(parseFloat(CenterLat), parseFloat(CenterLon)));
|
|
||||||
|
|
||||||
if (SelectedPlane) {
|
|
||||||
selectPlaneByHex(SelectedPlane);
|
|
||||||
}
|
|
||||||
|
|
||||||
refreshSelected();
|
|
||||||
refreshTableInfo();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawCircle(marker, distance) {
|
function drawCircle(marker, distance) {
|
||||||
|
|
Loading…
Reference in a new issue