Add option to disable map context menu

This commit is contained in:
James Lyne 2022-02-20 19:34:52 +00:00
parent 431f34e437
commit eba601e7fe
5 changed files with 13 additions and 1 deletions

View File

@ -160,6 +160,9 @@
// Use more compact pre-2.0 player marker style
compactPlayerMarkers: false,
// Disable the map right click menu
disableContextMenu: false,
},
// Config version. Do not modify.

View File

@ -31,7 +31,7 @@
</template>
</div>
<MapContextMenu :leaflet="leaflet" v-if="leaflet"></MapContextMenu>
<MapContextMenu v-if="contextMenuEnabled && leaflet" :leaflet="leaflet"></MapContextMenu>
</template>
<script lang="ts">
@ -81,6 +81,7 @@ export default defineComponent({
linkControlEnabled = computed(() => store.state.components.linkControl),
chatBoxEnabled = computed(() => store.state.components.chatBox),
loginEnabled = computed(() => store.state.components.login),
contextMenuEnabled = computed(() => !store.state.ui.disableContextMenu),
logoControls = computed(() => store.state.components.logoControls),
currentWorld = computed(() => store.state.currentWorld),
@ -108,6 +109,7 @@ export default defineComponent({
linkControlEnabled,
chatBoxEnabled,
loginEnabled,
contextMenuEnabled,
logoControls,
followTarget,

1
src/index.d.ts vendored
View File

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

View File

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

View File

@ -84,6 +84,7 @@ export type State = {
playersAboveMarkers: boolean;
playersSearch: boolean;
compactPlayerMarkers: boolean;
disableContextMenu: boolean;
screenWidth: number;
screenHeight: number;
@ -222,6 +223,7 @@ export const state: State = {
playersAboveMarkers: true,
playersSearch: true,
compactPlayerMarkers: false,
disableContextMenu: false,
screenWidth: window.innerWidth,
screenHeight: window.innerHeight,