From 98da512cd91ed6dcc2ab30d418899a6bc3d3d4cb Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Thu, 10 Dec 2020 13:35:58 +0100 Subject: [PATCH] fix labels ... not sure what the issue was some cleanup --- html/planeObject.js | 20 +++++++++----------- html/script.js | 9 +++++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index 40639ae..6525135 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -1081,7 +1081,7 @@ PlaneObject.prototype.processTrace = function() { this.visible = true; if (!showTime) { - this.updateFeatures(now, _last); + this.updateFeatures(true); } if (showTime && FollowSelected) { @@ -1425,14 +1425,10 @@ PlaneObject.prototype.updateData = function(now, last, data, init) { PlaneObject.prototype.updateTick = function(redraw) { this.visible = this.checkVisible() && !this.isFiltered(); - if (this.dataSource == "uat") { - this.updateFeatures(uat_now, uat_last, redraw); - } else { - this.updateFeatures(now, last, redraw); - } + this.updateFeatures(redraw); }; -PlaneObject.prototype.updateFeatures = function(now, last, redraw) { +PlaneObject.prototype.updateFeatures = function(redraw) { if (this.visible) { if (this.drawLine || redraw || this.lastVisible != this.visible) @@ -1526,9 +1522,11 @@ PlaneObject.prototype.updateMarker = function(moved) { this.marker = new ol.Feature(this.point); this.marker.hex = this.icao; } - if (webgl && !enableLabels && this.marker && this.marker.visible) { - PlaneIconFeatures.removeFeature(this.marker); - delete this.marker; + if (webgl && !enableLabels && this.marker) { + if (this.marker.visible) { + PlaneIconFeatures.removeFeature(this.marker); + this.marker.visible = false; + } } if (webgl) { @@ -1547,7 +1545,7 @@ PlaneObject.prototype.updateMarker = function(moved) { this.glMarker.set('dy', (getSpriteY(this.shape) + 1) / glImapHeight); } - if (this.marker) { + if (this.marker && (!webgl || enableLabels)) { this.updateIcon(); if (!this.marker.visible) { this.marker.visible = true; diff --git a/html/script.js b/html/script.js index 84da2c4..fb91ff7 100644 --- a/html/script.js +++ b/html/script.js @@ -2313,7 +2313,7 @@ function removeHighlight() { function refreshFeatures() { for (let i in PlanesOrdered) { - PlanesOrdered[i].updateTick(true); + PlanesOrdered[i].updateFeatures(true); } } @@ -2970,7 +2970,7 @@ function deselectAllPlanes(keepMain) { continue; plane.selected = false; - plane.updateTick(true); + plane.updateFeatures(true); } if (SelectedAllPlanes) { SelectedAllPlanes = false; @@ -3387,6 +3387,7 @@ function toggleLabels() { for (let key in PlanesOrdered) { PlanesOrdered[key].updateMarker(); } + refreshFeatures(); buttonActive('#L', enableLabels); if (showTrace) @@ -3925,7 +3926,7 @@ function mapRefresh() { } if (globeIndex && !icaoFilter) { for (let i in addToMap) { - addToMap[i].updateFeatures(now, last); + addToMap[i].updateFeatures(); } } else { for (let i in addToMap) { @@ -4647,7 +4648,7 @@ function drawAlt() { function remakeTrails() { for (let i in PlanesOrdered) { PlanesOrdered[i].remakeTrail(); - PlanesOrdered[i].updateTick(true); + PlanesOrdered[i].updateFeatures(true); } }