From 2f80f31a338aa9a2349c09acbf534a8a14be7583 Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Wed, 21 Aug 2024 21:49:28 +0200 Subject: [PATCH] Few more UX improvements --- .../utilities/zoneEditor/ZoneEditor.vue | 6 +++--- .../utilities/zoneEditor/partials/ObjectList.vue | 16 ++++++++-------- .../utilities/zoneEditor/partials/Toolbar.vue | 15 ++++++++++----- src/stores/zoneEditor.ts | 4 ++++ 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/components/utilities/zoneEditor/ZoneEditor.vue b/src/components/utilities/zoneEditor/ZoneEditor.vue index 2b26dbe..585b9ac 100644 --- a/src/components/utilities/zoneEditor/ZoneEditor.vue +++ b/src/components/utilities/zoneEditor/ZoneEditor.vue @@ -94,18 +94,18 @@ watch(objectList, (newObjects) => { }) function eraser(tile: Phaser.Tilemaps.Tile) { - if (zoneEditorStore.drawMode === 'tile') { + if (zoneEditorStore.eraserMode === 'tile') { placeTile(zoneTilemap, tiles, tile.x, tile.y, 'blank_tile') zoneTiles[tile.y][tile.x] = 'blank_tile' } - if (zoneEditorStore.drawMode === 'object') { + if (zoneEditorStore.eraserMode === 'object') { zoneObjects.value = zoneObjects.value.filter((object) => { return object.position_x !== tile.x || object.position_y !== tile.y }) } - if (zoneEditorStore.drawMode === 'blocking tile') { + if (zoneEditorStore.eraserMode === 'blocking tile') { zoneEventTiles.value = zoneEventTiles.value.filter((zoneTileEvent) => { return zoneTileEvent.position_x !== tile.x || zoneTileEvent.position_y !== tile.y }) diff --git a/src/components/utilities/zoneEditor/partials/ObjectList.vue b/src/components/utilities/zoneEditor/partials/ObjectList.vue index 1099c80..47c02e7 100644 --- a/src/components/utilities/zoneEditor/partials/ObjectList.vue +++ b/src/components/utilities/zoneEditor/partials/ObjectList.vue @@ -9,10 +9,10 @@ -
- - -
+ + + + @@ -58,12 +58,12 @@ const gameStore = useGameStore() const isModalOpen = ref(false) const zoneEditorStore = useZoneEditorStore() const searchQuery = ref('') -const objectDepth = ref(0) +// const objectDepth = ref(0) const selectedTags = ref([]) -watch(objectDepth, (depth) => { - zoneEditorStore.setObjectDepth(depth) -}) +// watch(objectDepth, (depth) => { +// zoneEditorStore.setObjectDepth(depth) +// }) const uniqueTags = computed(() => { const allTags = zoneEditorStore.objectList.flatMap((obj) => obj.tags || []) diff --git a/src/components/utilities/zoneEditor/partials/Toolbar.vue b/src/components/utilities/zoneEditor/partials/Toolbar.vue index e6bb7fa..e1f6a76 100644 --- a/src/components/utilities/zoneEditor/partials/Toolbar.vue +++ b/src/components/utilities/zoneEditor/partials/Toolbar.vue @@ -39,23 +39,23 @@ Eraser (E)
- {{ zoneEditorStore.drawMode }} + {{ zoneEditorStore.eraserMode }}
- + Tile
- + Object
- + Teleport
- Blocking tile + Blocking tile
@@ -112,6 +112,11 @@ function setDrawMode(value: string) { } zoneEditorStore.setDrawMode(value) selectPencilOpen.value = false +} + +// drawMode +function setEraserMode(value: string) { + zoneEditorStore.setEraserMode(value) selectEraserOpen.value = false } diff --git a/src/stores/zoneEditor.ts b/src/stores/zoneEditor.ts index d27e493..6f3582c 100644 --- a/src/stores/zoneEditor.ts +++ b/src/stores/zoneEditor.ts @@ -8,6 +8,7 @@ export const useZoneEditorStore = defineStore('zoneEditor', { zone: null as Zone | null, tool: 'move', drawMode: 'tile', + eraserMode: 'tile', zoneList: [] as Zone[], tileList: [] as Tile[], objectList: [] as Object[], @@ -55,6 +56,9 @@ export const useZoneEditorStore = defineStore('zoneEditor', { setDrawMode(mode: string) { this.drawMode = mode }, + setEraserMode(mode: string) { + this.eraserMode = mode + }, setZoneList(zones: Zone[]) { this.zoneList = zones },