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
disableContextMenu: false,
// Disable the markers button and list
disableMarkerUI: false,
},
// Config version. Do not modify.

View File

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

1
src/index.d.ts vendored
View File

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

View File

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

View File

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

View File

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