From fbe252472f8835c568fadfbf80fb750501b273ac Mon Sep 17 00:00:00 2001 From: James Lyne Date: Tue, 20 Jul 2021 20:27:07 +0100 Subject: [PATCH] Add setting for displaying players above/below other markers (Fixes #14) --- src/api.ts | 2 +- src/components/map/layer/PlayersLayer.vue | 11 ++++++----- src/scss/_leaflet.scss | 4 ---- src/store/state.ts | 3 +++ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/api.ts b/src/api.ts index ec4e88c..3ecba90 100644 --- a/src/api.ts +++ b/src/api.ts @@ -57,7 +57,7 @@ function buildServerConfig(response: any): DynmapServerConfig { } function buildMessagesConfig(response: any): LiveAtlasMessageConfig { - const liveAtlasMessages = window.liveAtlasConfig ? window.liveAtlasConfig.messages || {} : {}; + const liveAtlasMessages = window.liveAtlasConfig?.messages || {}; return { chatPlayerJoin: response.joinmessage || '', diff --git a/src/components/map/layer/PlayersLayer.vue b/src/components/map/layer/PlayersLayer.vue index 57d2024..809ad2c 100644 --- a/src/components/map/layer/PlayersLayer.vue +++ b/src/components/map/layer/PlayersLayer.vue @@ -42,12 +42,17 @@ export default defineComponent({ playerPane = props.leaflet.createPane('players'), players = computed(() => store.state.players), playerCount = computed(() => store.state.players.size), + playersAboveMarkers = computed(() => store.state.ui.playersAboveMarkers), componentSettings = computed(() => store.state.components.playerMarkers), layerGroup = new LayerGroup([],{ pane: 'players' }); - watch(playerCount, (newValue) => playerPane.classList.toggle('no-animations', newValue > 150)) + watch(playerCount, (newValue) => playerPane.classList.toggle('no-animations', newValue > 150)); + + if(playersAboveMarkers.value) { + playerPane.style.zIndex = '600'; + } return { players, @@ -80,7 +85,3 @@ export default defineComponent({ } }) - - \ No newline at end of file diff --git a/src/scss/_leaflet.scss b/src/scss/_leaflet.scss index 5107e49..5a5b4ac 100644 --- a/src/scss/_leaflet.scss +++ b/src/scss/_leaflet.scss @@ -15,7 +15,3 @@ } } } - -.leaflet-players-pane { - z-index: 600; -} diff --git a/src/store/state.ts b/src/store/state.ts index 03aa17d..2fc5824 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -69,6 +69,7 @@ export type State = { updateTimestamp: Date; ui: { + playersAboveMarkers: boolean; smallScreen: boolean; visibleElements: Set; previouslyVisibleElements: Set; @@ -221,6 +222,8 @@ export const state: State = { updateTimestamp: new Date(), ui: { + playersAboveMarkers: window.liveAtlasConfig?.ui?.playersAboveMarkers || false, + smallScreen: false, visibleElements: new Set(), previouslyVisibleElements: new Set(),