From b36c8117e78703106d1f53cb43ede48add365aea Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Thu, 13 Jun 2024 22:55:29 +0200 Subject: [PATCH] tile editor wip --- .../utilities/zoneEditor/Toolbar.vue | 4 +-- .../utilities/zoneEditor/ZoneEditor.vue | 12 ++++---- .../utilities/zoneEditor/ZoneSettings.vue | 27 +++++++++++++---- src/stores/zoneEditor.ts | 30 ++++++++++++------- src/types.ts | 2 +- 5 files changed, 51 insertions(+), 24 deletions(-) diff --git a/src/components/utilities/zoneEditor/Toolbar.vue b/src/components/utilities/zoneEditor/Toolbar.vue index da74a9b..87bcb95 100644 --- a/src/components/utilities/zoneEditor/Toolbar.vue +++ b/src/components/utilities/zoneEditor/Toolbar.vue @@ -28,13 +28,13 @@
-
- +
diff --git a/src/components/utilities/zoneEditor/ZoneEditor.vue b/src/components/utilities/zoneEditor/ZoneEditor.vue index c01f92b..c142531 100644 --- a/src/components/utilities/zoneEditor/ZoneEditor.vue +++ b/src/components/utilities/zoneEditor/ZoneEditor.vue @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/src/stores/zoneEditor.ts b/src/stores/zoneEditor.ts index a638baf..11126d1 100644 --- a/src/stores/zoneEditor.ts +++ b/src/stores/zoneEditor.ts @@ -1,23 +1,32 @@ import { defineStore } from 'pinia' -import config from '@/config' -import {type Zone} from '@/types' export const useZoneEditorStore = defineStore('zoneEditor', { state: () => ({ active: false, + name: '', + width: 10, + height: 10, tiles: [] as number[][], tool: 'move', drawMode: 'tile', selectedTile: null, selectedWall: null, selectedDecoration: null, - zoneSettings: null as Zone | null, - zoneSettingsOpen: false + isSettingsModalShown: false }), actions: { toggleActive() { this.active = !this.active }, + setName(name: string) { + this.name = name + }, + setWidth(width: number) { + this.width = width + }, + setHeight(height: number) { + this.height = height + }, setTiles(tiles: number[][]) { this.tiles = tiles }, @@ -36,21 +45,20 @@ export const useZoneEditorStore = defineStore('zoneEditor', { setSelectedDecoration(decoration: any) { this.selectedDecoration = decoration }, - setZoneSettings(zone: Zone) { - this.zoneSettings = zone - }, - toggleZoneSettings() { - this.zoneSettingsOpen = !this.zoneSettingsOpen + toggleSettingsModal() { + this.isSettingsModalShown = !this.isSettingsModalShown }, reset() { + this.name = '' + this.width = 10 + this.height = 10 this.tiles = [] this.tool = 'move' this.drawMode = 'tile' this.selectedTile = null this.selectedWall = null this.selectedDecoration = null - this.zoneSettings = null - this.zoneSettingsOpen = false + this.isSettingsModalShown = false } } }) \ No newline at end of file diff --git a/src/types.ts b/src/types.ts index 3c6069a..273e821 100644 --- a/src/types.ts +++ b/src/types.ts @@ -33,7 +33,7 @@ export type Zone = { name: string width: number height: number - tiles: Record + tiles: number[][] characters: Character[] chats: Chat[] }