Fix MarkerSet disappearing when a POI-Marker is being removed

This commit is contained in:
Lukas Rieger (Blue) 2022-10-21 23:11:39 +02:00
parent 4ee492bd1d
commit 8173979ed8
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
3 changed files with 3 additions and 3 deletions

View File

@ -45,7 +45,7 @@ export class HtmlMarker extends Marker {
this.fadeDistanceMax = Number.MAX_VALUE;
this.addEventListener( 'removed', () => {
if (this.element.parentNode) this.element.parentNode.removeChild(this.element);
if (this.element?.parentNode) this.element.parentNode.removeChild(this.element);
});
this.add(this.elementObject);

View File

@ -79,11 +79,11 @@ export class MarkerSet extends Scene {
// add & update MarkerSets
Object.keys(data).forEach(markerSetId => {
if (updatedMarkerSets.has(markerSetId)) return;
updatedMarkerSets.add(markerSetId);
let markerSetData = data[markerSetId];
try {
this.updateMarkerSetFromData(markerSetId, markerSetData);
updatedMarkerSets.add(markerSetId);
} catch (err) {
alert(this.events, err, "fine");
}

View File

@ -129,7 +129,7 @@ export const alert = (element, message, level = "info") => {
});
// log alert to console
if (printToConsole) {
if (printToConsole !== false) {
if (level === "info") {
console.log(`[BlueMap/${level}]`, message);
} else if (level === "warning") {