Handle player hiding correctly
This commit is contained in:
parent
31b05613fb
commit
fe07e6283c
@ -55,15 +55,16 @@ export default defineComponent({
|
|||||||
player: {
|
player: {
|
||||||
deep: true,
|
deep: true,
|
||||||
handler(newValue) {
|
handler(newValue) {
|
||||||
if(this.visible) {
|
if(this.currentWorld && newValue.location.world === this.currentWorld.name) {
|
||||||
this.marker!.setLatLng(this.currentProjection.locationToLatLng(newValue.location));
|
if(!this.visible) {
|
||||||
|
this.enableLayer();
|
||||||
// if(this.following) {
|
} else {
|
||||||
//
|
this.marker!.setLatLng(this.currentProjection.locationToLatLng(newValue.location));
|
||||||
// }
|
this.marker!.getIcon().update();
|
||||||
|
}
|
||||||
|
} else if(this.visible) {
|
||||||
|
this.disableLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.marker!.getIcon().update();
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
currentWorld(newValue) {
|
currentWorld(newValue) {
|
||||||
@ -88,6 +89,10 @@ export default defineComponent({
|
|||||||
pane: 'players',
|
pane: 'players',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(this.currentWorld) {
|
||||||
|
console.log(this.currentWorld.name, this.player.location.world);
|
||||||
|
}
|
||||||
|
|
||||||
if(this.currentWorld && this.currentWorld.name === this.player.location.world) {
|
if(this.currentWorld && this.currentWorld.name === this.player.location.world) {
|
||||||
this.enableLayer();
|
this.enableLayer();
|
||||||
}
|
}
|
||||||
@ -105,18 +110,14 @@ export default defineComponent({
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
enableLayer() {
|
enableLayer() {
|
||||||
// console.log('Enabling marker for ' + this.player.name);
|
if(this.marker && !this.visible) {
|
||||||
|
|
||||||
if(this.marker) {
|
|
||||||
this.layerGroup.addLayer(this.marker);
|
this.layerGroup.addLayer(this.marker);
|
||||||
this.marker.setLatLng(this.currentProjection.locationToLatLng(this.player.location));
|
this.marker.setLatLng(this.currentProjection.locationToLatLng(this.player.location));
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
disableLayer() {
|
disableLayer() {
|
||||||
// console.log('Disabling marker for ' + this.player.name);
|
if(this.marker && this.visible) {
|
||||||
|
|
||||||
if(this.marker) {
|
|
||||||
this.layerGroup.removeLayer(this.marker);
|
this.layerGroup.removeLayer(this.marker);
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user