Fix clear() method not actually clearing the markerset. Fixes: #430
This commit is contained in:
parent
e46efc4c53
commit
55fb955ed7
|
@ -251,6 +251,9 @@ export class BlueMapApp {
|
||||||
let map = this.mapsMap.get(mapId);
|
let map = this.mapsMap.get(mapId);
|
||||||
if (!map) return Promise.reject(`There is no map with the id "${mapId}" loaded!`);
|
if (!map) return Promise.reject(`There is no map with the id "${mapId}" loaded!`);
|
||||||
|
|
||||||
|
if (this.playerMarkerManager) this.playerMarkerManager.dispose();
|
||||||
|
if (this.markerFileManager) this.markerFileManager.dispose();
|
||||||
|
|
||||||
await this.mapViewer.switchMap(map)
|
await this.mapViewer.switchMap(map)
|
||||||
|
|
||||||
if (resetCamera) this.resetCamera();
|
if (resetCamera) this.resetCamera();
|
||||||
|
@ -353,10 +356,8 @@ export class BlueMapApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
initPlayerMarkerManager() {
|
initPlayerMarkerManager() {
|
||||||
if (this.playerMarkerManager){
|
if (this.playerMarkerManager)
|
||||||
this.playerMarkerManager.clear();
|
|
||||||
this.playerMarkerManager.dispose()
|
this.playerMarkerManager.dispose()
|
||||||
}
|
|
||||||
|
|
||||||
const map = this.mapViewer.map;
|
const map = this.mapViewer.map;
|
||||||
if (!map) return;
|
if (!map) return;
|
||||||
|
@ -369,16 +370,13 @@ export class BlueMapApp {
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
alert(this.events, e, "warning");
|
alert(this.events, e, "warning");
|
||||||
this.playerMarkerManager.clear();
|
|
||||||
this.playerMarkerManager.dispose();
|
this.playerMarkerManager.dispose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
initMarkerFileManager() {
|
initMarkerFileManager() {
|
||||||
if (this.markerFileManager) {
|
if (this.markerFileManager)
|
||||||
this.markerFileManager.clear();
|
|
||||||
this.markerFileManager.dispose();
|
this.markerFileManager.dispose();
|
||||||
}
|
|
||||||
|
|
||||||
const map = this.mapViewer.map;
|
const map = this.mapViewer.map;
|
||||||
if (!map) return;
|
if (!map) return;
|
||||||
|
@ -390,7 +388,6 @@ export class BlueMapApp {
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
alert(this.events, e, "warning");
|
alert(this.events, e, "warning");
|
||||||
this.markerFileManager.clear();
|
|
||||||
this.markerFileManager.dispose();
|
this.markerFileManager.dispose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,8 @@ export class MarkerManager {
|
||||||
*/
|
*/
|
||||||
update() {
|
update() {
|
||||||
return this.loadMarkerFile()
|
return this.loadMarkerFile()
|
||||||
.then(markerFileData => this.updateFromData(markerFileData));
|
.then(markerFileData => this.updateFromData(markerFileData))
|
||||||
|
.catch(() => this.clear());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -174,8 +174,8 @@ export class MarkerSet extends Scene {
|
||||||
* Removes all markers and marker-sets
|
* Removes all markers and marker-sets
|
||||||
*/
|
*/
|
||||||
clear() {
|
clear() {
|
||||||
[...this.data.markerSets].forEach(markerSet => this.remove(markerSet));
|
[...this.markerSets.values()].forEach(markerSet => this.remove(markerSet));
|
||||||
[...this.data.markers].forEach(marker => this.remove(marker));
|
[...this.markers.values()].forEach(marker => this.remove(marker));
|
||||||
}
|
}
|
||||||
|
|
||||||
add(...object) {
|
add(...object) {
|
||||||
|
|
|
@ -48,4 +48,8 @@ export class NormalMarkerManager extends MarkerManager {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
this.root.updateMarkerSetsFromData({}, [PLAYER_MARKER_SET_ID, "bm-popup-set"]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -78,4 +78,8 @@ export class PlayerMarkerManager extends MarkerManager {
|
||||||
return this.getPlayerMarkerSet().getPlayerMarker(playerUuid)
|
return this.getPlayerMarkerSet().getPlayerMarker(playerUuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clear() {
|
||||||
|
this.getPlayerMarkerSet(false).clear();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue