mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-22 08:11:33 +01:00
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);
|
||||
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)
|
||||
|
||||
if (resetCamera) this.resetCamera();
|
||||
@ -353,10 +356,8 @@ export class BlueMapApp {
|
||||
}
|
||||
|
||||
initPlayerMarkerManager() {
|
||||
if (this.playerMarkerManager){
|
||||
this.playerMarkerManager.clear();
|
||||
if (this.playerMarkerManager)
|
||||
this.playerMarkerManager.dispose()
|
||||
}
|
||||
|
||||
const map = this.mapViewer.map;
|
||||
if (!map) return;
|
||||
@ -369,16 +370,13 @@ export class BlueMapApp {
|
||||
})
|
||||
.catch(e => {
|
||||
alert(this.events, e, "warning");
|
||||
this.playerMarkerManager.clear();
|
||||
this.playerMarkerManager.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
initMarkerFileManager() {
|
||||
if (this.markerFileManager) {
|
||||
this.markerFileManager.clear();
|
||||
if (this.markerFileManager)
|
||||
this.markerFileManager.dispose();
|
||||
}
|
||||
|
||||
const map = this.mapViewer.map;
|
||||
if (!map) return;
|
||||
@ -390,7 +388,6 @@ export class BlueMapApp {
|
||||
})
|
||||
.catch(e => {
|
||||
alert(this.events, e, "warning");
|
||||
this.markerFileManager.clear();
|
||||
this.markerFileManager.dispose();
|
||||
});
|
||||
}
|
||||
|
@ -83,7 +83,8 @@ export class MarkerManager {
|
||||
*/
|
||||
update() {
|
||||
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
|
||||
*/
|
||||
clear() {
|
||||
[...this.data.markerSets].forEach(markerSet => this.remove(markerSet));
|
||||
[...this.data.markers].forEach(marker => this.remove(marker));
|
||||
[...this.markerSets.values()].forEach(markerSet => this.remove(markerSet));
|
||||
[...this.markers.values()].forEach(marker => this.remove(marker));
|
||||
}
|
||||
|
||||
add(...object) {
|
||||
|
@ -48,4 +48,8 @@ export class NormalMarkerManager extends MarkerManager {
|
||||
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)
|
||||
}
|
||||
|
||||
clear() {
|
||||
this.getPlayerMarkerSet(false).clear();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user