#321 - Show corresponding list when drawMode is selected & vice versa
Synced with main, cleaned up unused consts
This commit is contained in:
parent
dc7e20842a
commit
369522fda3
@ -27,14 +27,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import config from '@/application/config'
|
|
||||||
import type { Tile } from '@/application/types'
|
import type { Tile } from '@/application/types'
|
||||||
import { TileStorage } from '@/storage/storages'
|
import { TileStorage } from '@/storage/storages'
|
||||||
import { liveQuery } from 'dexie'
|
import { liveQuery } from 'dexie'
|
||||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
import { onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
|
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
|
||||||
import TileList from '@/components/gameMaster/mapEditor/partials/lists/TileList.vue'
|
import TileList from '@/components/gameMaster/mapEditor/partials/lists/TileList.vue'
|
||||||
import ObjectList from '@/components/gameMaster/mapEditor/partials/lists/MapObjectList.vue'
|
import ObjectList from '@/components/gameMaster/mapEditor/partials/lists/MapObjectList.vue'
|
||||||
|
|
||||||
|
const mapEditor = useMapEditorComposable()
|
||||||
|
|
||||||
const isOpen = ref(false)
|
const isOpen = ref(false)
|
||||||
const tileStorage = new TileStorage()
|
const tileStorage = new TileStorage()
|
||||||
const searchQuery = ref('')
|
const searchQuery = ref('')
|
||||||
@ -47,6 +49,22 @@ defineExpose({
|
|||||||
toggle: () => (isOpen.value = !isOpen.value)
|
toggle: () => (isOpen.value = !isOpen.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(lists, (list) => {
|
||||||
|
if (list === 'tiles') {
|
||||||
|
mapEditor.setDrawMode('tile')
|
||||||
|
} else if (list === 'objects') {
|
||||||
|
mapEditor.setDrawMode('map_object')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(() => mapEditor.drawMode.value, (list) => {
|
||||||
|
if (list === 'tile') {
|
||||||
|
lists.value = 'tiles'
|
||||||
|
} else if (list === 'map_object') {
|
||||||
|
lists.value = 'objects'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
let subscription: any = null
|
let subscription: any = null
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -112,12 +112,8 @@ const toolbar = ref(null)
|
|||||||
const isMapEditorSettingsModalOpen = ref(false)
|
const isMapEditorSettingsModalOpen = ref(false)
|
||||||
const selectPencilOpen = ref(false)
|
const selectPencilOpen = ref(false)
|
||||||
const selectEraserOpen = ref(false)
|
const selectEraserOpen = ref(false)
|
||||||
const tileListShown = ref(false)
|
|
||||||
const mapObjectListShown = ref(false)
|
|
||||||
const checkboxValue = ref<Boolean>(false)
|
const checkboxValue = ref<Boolean>(false)
|
||||||
|
|
||||||
defineExpose({ tileListShown, mapObjectListShown })
|
|
||||||
|
|
||||||
// drawMode
|
// drawMode
|
||||||
function setDrawMode(value: string) {
|
function setDrawMode(value: string) {
|
||||||
if (mapEditor.tool.value === 'paint' || mapEditor.tool.value === 'pencil' || mapEditor.tool.value === 'eraser') {
|
if (mapEditor.tool.value === 'paint' || mapEditor.tool.value === 'pencil' || mapEditor.tool.value === 'eraser') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user