From 17a4c3222bad2f6fa09b782c2aa203dae0eef67b Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Wed, 27 Nov 2019 22:25:32 +0100 Subject: [PATCH] honor SiteShow variable in config --- html/defaults.js | 6 +++--- html/script.js | 32 +++++++++++++++++--------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/html/defaults.js b/html/defaults.js index d637f73..67bb029 100644 --- a/html/defaults.js +++ b/html/defaults.js @@ -30,9 +30,9 @@ var DefaultZoomLvl = 7; // Center marker. If dump1090 provides a receiver location, // that location is used and these settings are ignored. -var SiteShow = false; // true to show a center marker -var SiteLat = 45.0; // position of the marker -var SiteLon = 9.0; +var SiteShow = true; // true to show a center marker +var SiteLat = null; // position of the marker +var SiteLon = null; var SiteName = "My Radar Site"; // tooltip of the marker // Color controls for the range outline diff --git a/html/script.js b/html/script.js index 934837d..6dd4c77 100644 --- a/html/script.js +++ b/html/script.js @@ -801,7 +801,6 @@ function make_geodesic_circle(center, radius, points) { // Initalizes the map and starts up our timers to call various functions function initialize_map() { if (receiverJson && receiverJson.lat != null) { - SiteShow = true; SiteLat = receiverJson.lat; SiteLon = receiverJson.lon; DefaultCenterLat = receiverJson.lat; @@ -817,7 +816,7 @@ function initialize_map() { MapType_tar1090="carto_light_all"; // Set SitePosition, initialize sorting - if (SiteShow && (typeof SiteLat !== 'undefined') && (typeof SiteLon !== 'undefined')) { + if (SiteLat != null && SiteLon != null) { SitePosition = [SiteLon, SiteLat]; sortByDistance(); } else { @@ -1014,20 +1013,23 @@ function initialize_map() { // Add home marker if requested if (SitePosition) { - var markerStyle = new ol.style.Style({ - image: new ol.style.Circle({ - radius: 7, - snapToPixel: false, - fill: new ol.style.Fill({color: 'black'}), - stroke: new ol.style.Stroke({ - color: 'white', width: 2 - }) - }) - }); - var feature = new ol.Feature(new ol.geom.Point(ol.proj.fromLonLat(SitePosition))); - feature.setStyle(markerStyle); - StaticFeatures.push(feature); + if (SiteShow) { + var markerStyle = new ol.style.Style({ + image: new ol.style.Circle({ + radius: 7, + snapToPixel: false, + fill: new ol.style.Fill({color: 'black'}), + stroke: new ol.style.Stroke({ + color: 'white', width: 2 + }) + }) + }); + + var feature = new ol.Feature(new ol.geom.Point(ol.proj.fromLonLat(SitePosition))); + feature.setStyle(markerStyle); + StaticFeatures.push(feature); + } if (SiteCircles) { createSiteCircleFeatures();