From f0e7dbd50d9069d642ef9882f77ec80f71bfc547 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Mon, 2 Mar 2020 23:34:09 +0100 Subject: [PATCH] hacky --- html/planeObject.js | 22 ++++++++++++++-------- html/script.js | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index 911d533..f9d9bc4 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -252,6 +252,10 @@ PlaneObject.prototype.updateTrack = function(now, last, serverTrack) { if (this.bad_position && this.position[0] == this.bad_position[0] && this.position[1] == this.bad_position[1]) return false; + if (this.position && SitePosition) { + this.sitedist = ol.sphere.getDistance(SitePosition, this.position); + } + var projHere = ol.proj.fromLonLat(this.position); var on_ground = (this.altitude === "ground"); @@ -277,10 +281,16 @@ PlaneObject.prototype.updateTrack = function(now, last, serverTrack) { var projPrev = ol.proj.fromLonLat(this.prev_position); var lastseg = this.track_linesegs[this.track_linesegs.length - 1]; - var distance = ol.sphere.getDistance(this.position, this.prev_position); - var derivedMach = (distance/(this.position_time - this.prev_time + 0.4))/343; - var filterSpeed = on_ground ? positionFilterSpeed/10 : positionFilterSpeed; - filterSpeed = (this.speed != null && this.prev_speed != null) ? (positionFilterGsFactor*(Math.max(this.speed, this.prev_speed)+10+(this.dataSource == "mlat")*100)/666) : filterSpeed; + var distance = 1000; + var derivedMach = 0.01; + var filterSpeed = 10000; + + if (positionFilter) { + distance = ol.sphere.getDistance(this.position, this.prev_position); + derivedMach = (distance/(this.position_time - this.prev_time + 0.4))/343; + filterSpeed = on_ground ? positionFilterSpeed/10 : positionFilterSpeed; + filterSpeed = (this.speed != null && this.prev_speed != null) ? (positionFilterGsFactor*(Math.max(this.speed, this.prev_speed)+10+(this.dataSource == "mlat")*100)/666) : filterSpeed; + } // ignore the position if the object moves faster than positionFilterSpeed (default Mach 3.5) // or faster than twice the transmitted groundspeed @@ -1256,10 +1266,6 @@ PlaneObject.prototype.updateFeatures = function(now, last, redraw) { var moved = false; if (this.updated) { - if (this.position && SitePosition) { - this.sitedist = ol.sphere.getDistance(SitePosition, this.position); - } - if (this.flight && this.flight.trim()) { this.name = this.flight; } else if (this.registration) { diff --git a/html/script.js b/html/script.js index 59eecaf..4dd74fe 100644 --- a/html/script.js +++ b/html/script.js @@ -3878,7 +3878,7 @@ function initSitePos() { if (SitePosInitialized) return; - if (SitePosition) { + if (SitePosition && !onMobile) { sortByDistance(); } else { sortByAltitude();