Add option to disable marker UI

This commit is contained in:
James Lyne 2022-04-01 13:27:17 +01:00
parent bc71650ec4
commit 9bac5f601d
6 changed files with 18 additions and 1 deletions

View File

@ -177,6 +177,9 @@
// Disable the map right click menu // Disable the map right click menu
disableContextMenu: false, disableContextMenu: false,
// Disable the markers button and list
disableMarkerUI: false,
}, },
// Config version. Do not modify. // Config version. Do not modify.

View File

@ -24,7 +24,7 @@
@click="handleSectionClick" @keydown="handleSectionKeydown"> @click="handleSectionClick" @keydown="handleSectionKeydown">
<SvgIcon :name="mapCount > 1 ? 'maps' : 'servers'"></SvgIcon> <SvgIcon :name="mapCount > 1 ? 'maps' : 'servers'"></SvgIcon>
</button> </button>
<button class="button--markers" data-section="markers" <button v-if="markerUIEnabled" class="button--markers" data-section="markers"
:title="messageMarkers" :title="messageMarkers"
:aria-label="messageMarkers" :aria-label="messageMarkers"
:aria-expanded="markersVisible" :aria-expanded="markersVisible"
@ -93,6 +93,7 @@ export default defineComponent({
messageMarkers = computed(() => store.state.messages.markersHeading), messageMarkers = computed(() => store.state.messages.markersHeading),
messagePlayers = computed(() => store.getters.playersHeading), messagePlayers = computed(() => store.getters.playersHeading),
markerUIEnabled = computed(() => store.getters.markerUIEnabled),
playerMakersEnabled = computed(() => store.getters.playerMarkersEnabled), playerMakersEnabled = computed(() => store.getters.playerMarkersEnabled),
playersVisible = computed(() => currentlyVisible.value.has('players')), playersVisible = computed(() => currentlyVisible.value.has('players')),
@ -165,6 +166,7 @@ export default defineComponent({
markersVisible, markersVisible,
followVisible, followVisible,
playerMakersEnabled, playerMakersEnabled,
markerUIEnabled,
handleSidebarKeydown, handleSidebarKeydown,
handleSectionKeydown, handleSectionKeydown,

1
src/index.d.ts vendored
View File

@ -124,6 +124,7 @@ interface LiveAtlasUIConfig {
playersSearch: boolean; playersSearch: boolean;
compactPlayerMarkers: boolean; compactPlayerMarkers: boolean;
disableContextMenu: boolean; disableContextMenu: boolean;
disableMarkerUI: boolean;
} }
export type LiveAtlasUIElement = 'layers' | 'chat' | LiveAtlasSidebarSection; export type LiveAtlasUIElement = 'layers' | 'chat' | LiveAtlasSidebarSection;

View File

@ -20,6 +20,7 @@ import {getMinecraftTime, getUrlForLocation} from "@/util";
export type Getters = { export type Getters = {
playerMarkersEnabled(state: State): boolean; playerMarkersEnabled(state: State): boolean;
markerUIEnabled(state: State): boolean;
coordinatesControlEnabled(state: State): boolean; coordinatesControlEnabled(state: State): boolean;
clockControlEnabled(state: State): boolean; clockControlEnabled(state: State): boolean;
loginEnabled(state: State): boolean; loginEnabled(state: State): boolean;
@ -35,6 +36,10 @@ export const getters: GetterTree<State, State> & Getters = {
return state.components.players.markers !== undefined; return state.components.players.markers !== undefined;
}, },
markerUIEnabled(state: State): boolean {
return !state.ui.disableMarkerUI;
},
coordinatesControlEnabled(state: State): boolean { coordinatesControlEnabled(state: State): boolean {
return state.components.coordinatesControl !== undefined; return state.components.coordinatesControl !== undefined;
}, },

View File

@ -134,6 +134,10 @@ export const mutations: MutationTree<State> & Mutations = {
state.ui.disableContextMenu = uiConfig.disableContextMenu; state.ui.disableContextMenu = uiConfig.disableContextMenu;
} }
if(typeof uiConfig.disableMarkerUI === 'boolean') {
state.ui.disableMarkerUI = uiConfig.disableMarkerUI;
}
if(typeof uiConfig.playersSearch === 'boolean') { if(typeof uiConfig.playersSearch === 'boolean') {
state.ui.playersSearch = uiConfig.playersSearch; state.ui.playersSearch = uiConfig.playersSearch;
} }

View File

@ -87,6 +87,7 @@ export type State = {
playersSearch: boolean; playersSearch: boolean;
compactPlayerMarkers: boolean; compactPlayerMarkers: boolean;
disableContextMenu: boolean; disableContextMenu: boolean;
disableMarkerUI: boolean;
screenWidth: number; screenWidth: number;
screenHeight: number; screenHeight: number;
@ -228,6 +229,7 @@ export const state: State = {
playersSearch: true, playersSearch: true,
compactPlayerMarkers: false, compactPlayerMarkers: false,
disableContextMenu: false, disableContextMenu: false,
disableMarkerUI: false,
screenWidth: window.innerWidth, screenWidth: window.innerWidth,
screenHeight: window.innerHeight, screenHeight: window.innerHeight,