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 // Use more compact pre-2.0 player marker style
compactPlayerMarkers: false, compactPlayerMarkers: false,
// Disable the map right click menu
disableContextMenu: false,
}, },
// Config version. Do not modify. // Config version. Do not modify.

View File

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

1
src/index.d.ts vendored
View File

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

View File

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

View File

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