From 5a519e46a1dc9ac034c412a8d2b91a854aebd778 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Wed, 6 Nov 2019 12:02:12 +0100 Subject: [PATCH] don't deselect on Home/Reset Map fix unknown altitude handling for rounded alitudes. --- html/planeObject.js | 16 +++++----------- html/script.js | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index a307ca5..6ebf1b5 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -490,7 +490,7 @@ PlaneObject.prototype.getMarkerColor = function() { var h, s, l; - var colorArr = this.getAltitudeColor(this.alt_rounded); + var colorArr = altitudeColor(this.alt_rounded); h = colorArr[0]; s = colorArr[1]; @@ -535,14 +535,6 @@ PlaneObject.prototype.getMarkerColor = function() { return 'hsl(' + h.toFixed(0) + ',' + s.toFixed(0) + '%,' + l.toFixed(0) + '%)' } -PlaneObject.prototype.getAltitudeColor = function(altitude) { - - if (typeof altitude === 'undefined') { - altitude = this.alt_rounded; - } - return altitudeColor(altitude); -} - function altitudeColor(altitude) { var h, s, l; @@ -1057,7 +1049,7 @@ PlaneObject.prototype.altitudeLines = function(segment) { else return estimateStyle; } - var colorArr = this.getAltitudeColor(segment.altitude); + var colorArr = altitudeColor(segment.altitude); //var color = 'hsl(' + colorArr[0].toFixed(0) + ', ' + colorArr[1].toFixed(0) + '%, ' + colorArr[2].toFixed(0) + '%)'; var color = hslToRgb(colorArr[0], colorArr[1], colorArr[2]); const lineKey = color + '_' + debugTracks + '_' + noVanish; @@ -1218,7 +1210,9 @@ PlaneObject.prototype.destroy = function() { }; function calcAltitudeRounded(altitude) { - if (altitude == "ground") { + if (altitude == null) { + return null; + } else if (altitude == "ground") { return altitude; } else if (altitude > 10000) { return (altitude/1000).toFixed(0)*1000; diff --git a/html/script.js b/html/script.js index 1f602d4..e7bef3a 100644 --- a/html/script.js +++ b/html/script.js @@ -2064,7 +2064,7 @@ function resetMap() { OLMap.getView().setCenter(ol.proj.fromLonLat([CenterLon, CenterLat])); OLMap.getView().setRotation(mapOrientation); - selectPlaneByHex(null,false); + //selectPlaneByHex(null,false); $("#update_error").css('display','none'); }