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