From dc9489d1a17e0d2d94f99fcb7cb2a4b9f560bc13 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Thu, 1 Jul 2021 23:49:22 +0200 Subject: [PATCH] reduce CPU for globe a bit --- html/planeObject.js | 11 ++++++----- html/script.js | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index b4790b4..fe1ac4a 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -1149,11 +1149,12 @@ PlaneObject.prototype.processTrace = function() { }; PlaneObject.prototype.updatePositionData = function(now, last, data, init) { - let newPos = this.updateTrack(now, last); + if (!globeIndex || this.selected || SelectedAllPlanes) { + let newPos = this.updateTrack(now, last); + this.drawLine |= newPos; + } - this.drawLine |= newPos; - - if (globeIndex && newPos) { + if (globeIndex) { this.trace.push({ now: this.position_time, position: this.position, @@ -1163,7 +1164,7 @@ PlaneObject.prototype.updatePositionData = function(now, last, data, init) { track: this.track, rotation: this.rotation, }); - if (this.trace.length > 20) { + if (this.trace.length > 100) { this.trace.slice(-15); } } diff --git a/html/script.js b/html/script.js index 01814b5..fa436e1 100644 --- a/html/script.js +++ b/html/script.js @@ -3475,6 +3475,13 @@ function selectAllPlanes() { toggleIsolation(false, "off"); SelectedAllPlanes = true; + + if (globeIndex) { + for (let i in PlanesOrdered) { + let plane = PlanesOrdered[i]; + plane.processTrace(); + } + } refreshFeatures(); jQuery('#selectall_checkbox').addClass('settingsCheckboxChecked');