1
0
forked from noxious/client

Better naming

This commit is contained in:
Dennis Postma 2025-01-06 00:11:19 +01:00
parent 37b97b0aac
commit 41f82897a8

View File

@ -4,7 +4,7 @@
</template>
<script setup lang="ts">
import type { PlacedMapObject as PlacedMapObjectT } from '@/application/types'
import type { MapObject, PlacedMapObject as PlacedMapObjectT } from '@/application/types'
import { uuidv4 } from '@/application/utilities'
import { getTile } from '@/composables/mapComposable'
import { useMapEditorStore } from '@/stores/mapEditorStore'
@ -125,7 +125,7 @@ function objectPicker(pointer: Phaser.Input.Pointer) {
if (!existingPlacedMapObject) return
// Select the object
mapEditorStore.setSelectedMapObject(existingPlacedMapObject)
mapEditorStore.setSelectedMapObject(existingPlacedMapObject.mapObject)
}
function moveMapObject(id: string) {
@ -205,18 +205,18 @@ onUnmounted(() => {
// watch mapEditorStore.mapObjectList and update originX and originY of objects in mapObjects
watch(
() => mapEditorStore.mapObjectList,
(newObjects) => {
(newMapObjects) => {
if (!mapEditorStore.map) return
const updatedMapObjects = mapEditorStore.map.placedMapObjects.map((mapObject) => {
const updatedObject = newObjects.find((obj) => obj.id === mapObject.mapObject.id)
if (updatedObject) {
const updatedMapObject = newMapObjects.find((obj) => obj.id === mapObject.mapObject.id)
if (updatedMapObject) {
return {
...mapObject,
mapObject: {
...mapObject.mapObject,
originX: updatedObject.originX,
originY: updatedObject.originY
originX: updatedMapObject.originX,
originY: updatedMapObject.originY
}
}
}
@ -231,12 +231,12 @@ watch(
// Update selectedMapObject if it's set
if (mapEditorStore.selectedMapObject) {
const updatedObject = newObjects.find((obj) => obj.id === mapEditorStore.selectedMapObject?.id)
if (updatedObject) {
const updatedMapObject = newMapObjects.find((obj) => obj.id === mapEditorStore.selectedMapObject?.id)
if (updatedMapObject) {
mapEditorStore.setSelectedMapObject({
...mapEditorStore.selectedMapObject,
originX: updatedObject.originX,
originY: updatedObject.originY
originX: updatedMapObject.originX,
originY: updatedMapObject.originY
})
}
}