diff --git a/html/planeObject.js b/html/planeObject.js index fc2bf9d..be8a872 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -1268,22 +1268,6 @@ PlaneObject.prototype.updateData = function(now, last, data, init) { this.updateAlt(); - if (this.altitude == null) { - this.onGround = null; - this.zIndex = 10; - } else if (this.altitude == "ground") { - this.onGround = true; - this.zIndex = 5; - } else { - this.onGround = false; - this.zIndex = this.altitude + 10000; - } - if (this.category == 'C3' || this.icaoType == 'TWR') { - this.zIndex = 1; - } - if (this.fakeHex) - this.zIndex -= 100000; - if (gs != null) this.gs = gs; else if (data.speed != null) @@ -2451,12 +2435,23 @@ PlaneObject.prototype.checkForDB = function(t) { }; PlaneObject.prototype.updateAlt = function(t) { this.alt_rounded = calcAltitudeRounded(this.altitude); - if (this.altitude == 'ground') - this.altSort = -100001; - else if (this.altitude) - this.altSort = this.altitude; - else - this.altSort = -100000; + + if (this.altitude == null) { + this.onGround = null; + this.zIndex = 10; + } else if (this.altitude == "ground") { + this.onGround = true; + this.zIndex = 5; + } else { + this.onGround = false; + this.zIndex = this.altitude + 200000; + } + if (this.category == 'C3' || this.icaoType == 'TWR') { + this.zIndex = 1; + } + if (this.fakeHex) + this.zIndex -= 100000; + } PlaneObject.prototype.setProjection = function(arg) { let pos = traceOpts.animate ? traceOpts.animatePos : this.position; diff --git a/html/script.js b/html/script.js index a53bc7f..9fbfb5a 100644 --- a/html/script.js +++ b/html/script.js @@ -4373,7 +4373,7 @@ function mapRefresh(redraw) { // delete all feature objects so they are recreated, this is important // draw order will be insertion / updateFeatures / updateTick order - addToMap.sort(function(x, y) { return x.altSort - y.altSort; }); + addToMap.sort(function(x, y) { return x.zIndex - y.zIndex; }); //console.log('maprefresh(): ' + addToMap.length); if (webgl) { webglFeatures.clear();