Refactoring of modalShown booleans
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import type { MapObject } from '@/application/types'
|
||||
import { defineStore } from 'pinia'
|
||||
import type { Map as MapT } from '@/application/types'
|
||||
|
||||
export type TeleportSettings = {
|
||||
toMapId: string
|
||||
@ -11,17 +12,11 @@ export type TeleportSettings = {
|
||||
export const useMapEditorStore = defineStore('mapEditor', {
|
||||
state: () => {
|
||||
return {
|
||||
active: false,
|
||||
active: true,
|
||||
tool: 'move',
|
||||
drawMode: 'tile',
|
||||
eraserMode: 'tile',
|
||||
selectedTile: '',
|
||||
selectedMapObject: null as MapObject | null,
|
||||
isTileListModalShown: false,
|
||||
isMapObjectListModalShown: false,
|
||||
isMapListModalShown: false,
|
||||
isCreateMapModalShown: false,
|
||||
isSettingsModalShown: false,
|
||||
shouldClearTiles: false,
|
||||
teleportSettings: {
|
||||
toMapId: '',
|
||||
@ -32,35 +27,18 @@ export const useMapEditorStore = defineStore('mapEditor', {
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
toggleActive() {
|
||||
if (this.active) this.reset()
|
||||
this.active = !this.active
|
||||
},
|
||||
setTool(tool: string) {
|
||||
this.tool = tool
|
||||
},
|
||||
setDrawMode(mode: string) {
|
||||
this.drawMode = mode
|
||||
},
|
||||
setEraserMode(mode: string) {
|
||||
this.eraserMode = mode
|
||||
},
|
||||
setSelectedTile(tile: string) {
|
||||
this.selectedTile = tile
|
||||
},
|
||||
setSelectedMapObject(object: MapObject) {
|
||||
this.selectedMapObject = object
|
||||
},
|
||||
toggleSettingsModal() {
|
||||
this.isSettingsModalShown = !this.isSettingsModalShown
|
||||
},
|
||||
toggleMapListModal() {
|
||||
this.isMapListModalShown = !this.isMapListModalShown
|
||||
this.isCreateMapModalShown = false
|
||||
},
|
||||
toggleCreateMapModal() {
|
||||
this.isCreateMapModalShown = !this.isCreateMapModalShown
|
||||
},
|
||||
setTeleportSettings(teleportSettings: TeleportSettings) {
|
||||
this.teleportSettings = teleportSettings
|
||||
},
|
||||
@ -75,11 +53,6 @@ export const useMapEditorStore = defineStore('mapEditor', {
|
||||
this.drawMode = 'tile'
|
||||
this.selectedTile = ''
|
||||
this.selectedMapObject = null
|
||||
this.isTileListModalShown = false
|
||||
this.isMapObjectListModalShown = false
|
||||
this.isSettingsModalShown = false
|
||||
this.isMapListModalShown = false
|
||||
this.isCreateMapModalShown = false
|
||||
this.shouldClearTiles = false
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user