Added check if there is no player data
This commit is contained in:
@@ -158,7 +158,8 @@ for (let i = 0; i < markers.length; i++) {
|
|||||||
/**
|
/**
|
||||||
* Add player's position marker
|
* Add player's position marker
|
||||||
*/
|
*/
|
||||||
if ( players ) {
|
if ( players && Object.keys(players).length > 0 ) {
|
||||||
|
console.log(players)
|
||||||
const playersPosition =[
|
const playersPosition =[
|
||||||
convertYToScale(players.markerCoords.y),
|
convertYToScale(players.markerCoords.y),
|
||||||
convertXToScale(players.markerCoords.x)
|
convertXToScale(players.markerCoords.x)
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const hasPlayers = computed(() => Object.keys(props.players).length > 0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marker geolocation
|
* Marker geolocation
|
||||||
* We need to use onUpdated hook because the list is not always rendered, and it often rebuilt.
|
* We need to use onUpdated hook because the list is not always rendered, and it often rebuilt.
|
||||||
@@ -83,7 +85,7 @@ onUpdated(() => {
|
|||||||
<i class="search-icon ph-fill ph-magnifying-glass"></i>
|
<i class="search-icon ph-fill ph-magnifying-glass"></i>
|
||||||
<input ref="qInput" name="recherche" type="text" v-model="q" title="Rechercher le monde" placeholder="Ville, point d'intérêt…">
|
<input ref="qInput" name="recherche" type="text" v-model="q" title="Rechercher le monde" placeholder="Ville, point d'intérêt…">
|
||||||
|
|
||||||
<button data-to-players class="player-btn" :tabindex="shouldBeActive ? 1 : 0" title="Aller à la position actuelle des joueurs">
|
<button v-if="hasPlayers" data-to-players class="player-btn" :tabindex="shouldBeActive ? 1 : 0" title="Aller à la position actuelle des joueurs">
|
||||||
<i class="pin-icon ph-fill ph-map-pin"></i>
|
<i class="pin-icon ph-fill ph-map-pin"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user