diff --git a/src/components/gameMaster/mapEditor/Map.vue b/src/components/gameMaster/mapEditor/Map.vue
index 321ebd7..74d11a5 100644
--- a/src/components/gameMaster/mapEditor/Map.vue
+++ b/src/components/gameMaster/mapEditor/Map.vue
@@ -1,7 +1,7 @@
-
+
diff --git a/src/components/gameMaster/mapEditor/partials/MapSettings.vue b/src/components/gameMaster/mapEditor/partials/MapSettings.vue
index a3b7e47..8dc96c1 100644
--- a/src/components/gameMaster/mapEditor/partials/MapSettings.vue
+++ b/src/components/gameMaster/mapEditor/partials/MapSettings.vue
@@ -14,22 +14,19 @@
-
+
-
+
-
+
-
@@ -51,15 +48,15 @@ import type { UUID } from '@/application/types'
import { uuidv4 } from '@/application/utilities'
import Modal from '@/components/utilities/Modal.vue'
import { useMapEditorComposable } from '@/composables/useMapEditorComposable'
-import { ref, useTemplateRef, watch } from 'vue'
+import { onMounted, ref, useTemplateRef, watch } from 'vue'
const mapEditor = useMapEditorComposable()
const screen = ref('settings')
-const name = ref(mapEditor.currentMap.value?.name)
-const width = ref(mapEditor.currentMap.value?.width)
-const height = ref(mapEditor.currentMap.value?.height)
-const pvp = ref(mapEditor.currentMap.value?.pvp)
+const name = ref
("Map")
+const width = ref(0)
+const height = ref(0)
+const pvp = ref(false)
const mapEffects = ref(mapEditor.currentMap.value?.mapEffects || [])
const modalRef = useTemplateRef('modalRef')
@@ -67,24 +64,18 @@ defineExpose({
open: () => modalRef.value?.open()
})
-watch(name, (value) => {
- mapEditor.updateProperty('name', value!)
-})
+function updateValue(event: Event) {
+ let ev = event.target as HTMLInputElement
+ mapEditor.updateProperty(ev.name as 'name' | 'width' | 'height' | 'pvp' | 'mapEffects', ev.value)
+}
-watch(width, (value) => {
- mapEditor.updateProperty('width', value!)
-})
-
-watch(height, (value) => {
- mapEditor.updateProperty('height', value!)
-})
-
-watch(pvp, (value) => {
- mapEditor.updateProperty('pvp', value!)
-})
-
-watch(mapEffects, (value) => {
- mapEditor.updateProperty('mapEffects', value!)
+watch(() => mapEditor.currentMap.value, (map) => {
+ if (!map) return
+ name.value = map.name
+ width.value = map.width
+ height.value = map.height
+ pvp.value = map.pvp
+ mapEffects.value = map.mapEffects
})
const addEffect = () => {
@@ -94,9 +85,12 @@ const addEffect = () => {
effect: '',
strength: 1
})
+ mapEditor.updateProperty('mapEffects', mapEffects.value)
}
const removeEffect = (index: number) => {
mapEffects.value.splice(index, 1)
+ mapEditor.updateProperty('mapEffects', mapEffects.value)
}
+