From 5896d4504c29d8e6c34e32797c6642076ef72f5b Mon Sep 17 00:00:00 2001 From: James Lyne Date: Wed, 29 Sep 2021 15:31:09 +0100 Subject: [PATCH] Fix PlayerMarker name disappearing when hidden --- src/leaflet/icon/PlayerIcon.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/leaflet/icon/PlayerIcon.ts b/src/leaflet/icon/PlayerIcon.ts index 75ff74b..c35dbc5 100644 --- a/src/leaflet/icon/PlayerIcon.ts +++ b/src/leaflet/icon/PlayerIcon.ts @@ -58,8 +58,7 @@ export class PlayerIcon extends Layer implements Icon { DomUtil.remove(oldIcon); } - const player = this._player; - + this._currentName = undefined; this._container = document.createElement('div'); this._container.classList.add('marker', 'marker--player', 'leaflet-marker-icon'); @@ -73,7 +72,7 @@ export class PlayerIcon extends Layer implements Icon { this._playerImage.height = this._playerImage.width = getImagePixelSize(this.options.imageSize); if (this.options.showSkin) { - getMinecraftHead(player, this.options.imageSize).then(head => { + getMinecraftHead(this._player, this.options.imageSize).then(head => { this._playerImage!.src = head.src; }).catch(() => {}); }