From 016b7846348e4111e8e9e61e8ffcce33fab50f6d Mon Sep 17 00:00:00 2001 From: James Lyne Date: Wed, 29 Sep 2021 15:02:17 +0100 Subject: [PATCH] Fix PlayerMarker health/armor not displaying immediately --- src/leaflet/icon/PlayerIcon.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/leaflet/icon/PlayerIcon.ts b/src/leaflet/icon/PlayerIcon.ts index 37b876c..75ff74b 100644 --- a/src/leaflet/icon/PlayerIcon.ts +++ b/src/leaflet/icon/PlayerIcon.ts @@ -61,7 +61,6 @@ export class PlayerIcon extends Layer implements Icon { const player = this._player; this._container = document.createElement('div'); - this._container.classList.add('marker', 'marker--player', 'leaflet-marker-icon'); this._playerInfo = document.createElement('div'); @@ -69,7 +68,6 @@ export class PlayerIcon extends Layer implements Icon { this._playerName = document.createElement('span'); this._playerName.className = 'player__name'; - this._playerName.innerHTML = this._currentName = player.displayName; this._playerImage = playerImage.cloneNode() as HTMLImageElement; this._playerImage.height = this._playerImage.width = getImagePixelSize(this.options.imageSize); @@ -82,7 +80,6 @@ export class PlayerIcon extends Layer implements Icon { this._playerInfo.appendChild(this._playerImage); this._playerInfo.appendChild(this._playerName); - this._container.appendChild(this._playerInfo); if (this.options.showHealth) { this._playerHealth = document.createElement('meter'); @@ -102,6 +99,9 @@ export class PlayerIcon extends Layer implements Icon { this._playerInfo.appendChild(this._playerArmor); } + this._container.appendChild(this._playerInfo); + this.update(); + return this._container; }