This commit is contained in:
Dennis Postma 2025-02-09 22:09:42 +01:00
parent 790a62c600
commit f45a51c230

View File

@ -68,7 +68,7 @@
<div class="w-px bg-cyan"></div> <div class="w-px bg-cyan"></div>
<button class="flex justify-center items-center min-w-10 p-0 relative" @click="handleClick('settings')"><img class="invert w-5 h-5" src="/assets/icons/mapEditor/gear.svg" alt="Map settings" /> <span class="h-5 ml-2.5">(Z)</span></button> <button class="flex justify-center items-center min-w-10 p-0 relative" @click="isMapEditorSettingsModalOpen = !isMapEditorSettingsModalOpen"><img class="invert w-5 h-5" src="/assets/icons/mapEditor/gear.svg" alt="Map settings" /> <span class="h-5 ml-2.5">(Z)</span></button>
<div class="w-px bg-cyan"></div> <div class="w-px bg-cyan"></div>
@ -100,7 +100,7 @@
import Modal from '@/components/utilities/Modal.vue' import Modal from '@/components/utilities/Modal.vue'
import { useMapEditorComposable } from '@/composables/useMapEditorComposable' import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
import { onClickOutside } from '@vueuse/core' import { onClickOutside } from '@vueuse/core'
import { onBeforeUnmount, onMounted, ref } from 'vue' import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
const mapEditor = useMapEditorComposable() const mapEditor = useMapEditorComposable()
@ -112,7 +112,7 @@ const isMapEditorSettingsModalOpen = ref(false)
const selectPencilOpen = ref(false) const selectPencilOpen = ref(false)
const selectEraserOpen = ref(false) const selectEraserOpen = ref(false)
const checkboxValue = ref<Boolean>(false) const checkboxValue = ref<Boolean>(false)
const listOpen = ref(false) const listOpen = computed(() => mapEditor.tool.value ==='pencil' && (mapEditor.drawMode.value === 'tile' || mapEditor.drawMode.value === 'map_object'))
// drawMode // drawMode
function setDrawMode(value: string) { function setDrawMode(value: string) {
@ -142,18 +142,7 @@ function handleModeClick(mode: string, type: 'pencil' | 'eraser') {
} }
function handleClick(tool: string) { function handleClick(tool: string) {
if (tool === 'mapEditorSettings') { mapEditor.setTool(tool)
isMapEditorSettingsModalOpen.value = true
listOpen.value = false
} else if (tool === 'settings') {
listOpen.value = false
} else if (tool === 'move') {
listOpen.value = false
mapEditor.setTool(tool)
} else {
mapEditor.setTool(tool)
}
selectPencilOpen.value = tool === 'pencil' ? !selectPencilOpen.value : false selectPencilOpen.value = tool === 'pencil' ? !selectPencilOpen.value : false
selectEraserOpen.value = tool === 'eraser' ? !selectEraserOpen.value : false selectEraserOpen.value = tool === 'eraser' ? !selectEraserOpen.value : false
} }
@ -171,7 +160,7 @@ function initKeyShortcuts(event: KeyboardEvent) {
// Check if map is set // Check if map is set
if (!mapEditor.currentMap.value) return if (!mapEditor.currentMap.value) return
// prevent if focused on composables // prevent if focused on inputs
if (document.activeElement?.tagName === 'INPUT') return if (document.activeElement?.tagName === 'INPUT') return
if (event.ctrlKey) return if (event.ctrlKey) return