fix releaseMem ...

this time without flashing icons
This commit is contained in:
Matthias Wirth
2022-07-24 09:02:37 +02:00
parent efaf88795a
commit 8d8e3f410b
2 changed files with 10 additions and 3 deletions

View File

@@ -967,7 +967,7 @@ PlaneObject.prototype.updateIcon = function() {
let styleKey = (webgl ? '' : svgKey) + '!' + labelText + '!' + this.scale;
if (this.styleKey != styleKey) {
if (this.styleKey != styleKey || !this.marker.getStyle()) {
this.styleKey = styleKey;
let style;
if (labelText) {
@@ -1667,10 +1667,14 @@ PlaneObject.prototype.clearMarker = function() {
PlaneIconFeatures.removeFeature(this.marker);
this.marker.visible = false;
}
delete this.marker;
if (this.glMarker && this.glMarker.visible) {
webglFeatures.removeFeature(this.glMarker);
this.glMarker.visible = false;
}
delete this.glMarker;
delete this.styleKey;
delete this.olPoint;
};
// Update our marker on the map

View File

@@ -3395,14 +3395,15 @@ function removeHighlight() {
// OpenLayers might have some slight memory retention issues
// recreating all OpenLayers Features for the planes every now and then releases that retained memory
function releaseMem() {
//console.log('releaseMem()');
for (let i in PlanesOrdered) {
PlanesOrdered[i].clearMarker();
PlanesOrdered[i].destroyTrace();
PlanesOrdered[i].destroyTR();
}
refreshFeatures();
mapRefresh(true);
TAR.planeMan.redraw();
//mapRefresh(true);
}
function refreshFeatures() {
@@ -7473,8 +7474,10 @@ function showReplayBar(){
function timeoutFetch() {
fetchData();
timers.checkMove = setTimeout(timeoutFetch, Math.max(RefreshInterval, 10000));
if (now - lastReap > 120) {
reaper();
}
}
function handleVisibilityChange() {
const prevHidden = tabHidden;