Open teleport modal fix

This commit is contained in:
Dennis Postma 2025-02-14 02:42:01 +01:00
parent bcf0d2832d
commit 90c0ed3141

View File

@ -41,13 +41,13 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Map } from '@/application/types' import type { Map } from '@/application/types'
import Modal from '@/components/utilities/Modal.vue' import Modal from '@/components/utilities/Modal.vue'
import { useMapEditorStore } from '@/stores/mapEditorStore'
import { computed, onMounted, ref, useTemplateRef, watch } from 'vue' import { computed, onMounted, ref, useTemplateRef, watch } from 'vue'
import {MapStorage} from "@/storage/storages"; import {MapStorage} from "@/storage/storages";
import {useMapEditorComposable} from "@/composables/useMapEditorComposable";
const showTeleportModal = computed(() => mapEditorStore.tool === 'pencil' && mapEditorStore.drawMode === 'teleport') const showTeleportModal = computed(() => mapEditor.tool.value === 'pencil' && mapEditor.drawMode.value === 'teleport')
const mapStorage = new MapStorage() const mapStorage = new MapStorage()
const mapEditorStore = useMapEditorStore() const mapEditor = useMapEditorComposable()
const modalRef = useTemplateRef('modalRef') const modalRef = useTemplateRef('modalRef')
const mapList = ref<Map[]>([]) const mapList = ref<Map[]>([])
@ -58,7 +58,7 @@ defineExpose({
const { toPositionX, toPositionY, toRotation, toMap } = useRefTeleportSettings() const { toPositionX, toPositionY, toRotation, toMap } = useRefTeleportSettings()
function useRefTeleportSettings() { function useRefTeleportSettings() {
const settings = mapEditorStore.teleportSettings const settings = mapEditor.teleportSettings.value
return { return {
toPositionX: ref(settings.toPositionX), toPositionX: ref(settings.toPositionX),
toPositionY: ref(settings.toPositionY), toPositionY: ref(settings.toPositionY),
@ -70,7 +70,7 @@ function useRefTeleportSettings() {
watch([toPositionX, toPositionY, toRotation, toMap], updateTeleportSettings) watch([toPositionX, toPositionY, toRotation, toMap], updateTeleportSettings)
function updateTeleportSettings() { function updateTeleportSettings() {
mapEditorStore.setTeleportSettings({ mapEditor.setTeleportSettings({
toPositionX: toPositionX.value, toPositionX: toPositionX.value,
toPositionY: toPositionY.value, toPositionY: toPositionY.value,
toRotation: toRotation.value, toRotation: toRotation.value,