1
0
forked from noxious/client

Update origin X and Y values in real-time

This commit is contained in:
2025-02-06 14:02:50 +01:00
parent 15b212160d
commit 7071d934b4
3 changed files with 24 additions and 4 deletions

View File

@ -25,6 +25,12 @@ const teleportSettings = ref<TeleportSettings>({
toRotation: 0
})
/**
* We can update origin X and Y in src/components/gameMaster/mapEditor/partials/SelectedPlacedMapObject.vue
* and this will trigger a refresh for spawned mao objects
*/
const refreshMapObject = ref(0)
export function useMapEditorComposable() {
const loadMap = (map: Map) => {
currentMap.value = map
@ -79,6 +85,10 @@ export function useMapEditorComposable() {
shouldClearTiles.value = false
}
function triggerMapObjectRefresh() {
refreshMapObject.value++ // Increment to trigger watchers
}
const reset = () => {
tool.value = 'move'
drawMode.value = 'tile'
@ -86,6 +96,7 @@ export function useMapEditorComposable() {
selectedTile.value = ''
selectedMapObject.value = null
shouldClearTiles.value = false
refreshMapObject.value = 0
}
return {
@ -101,6 +112,7 @@ export function useMapEditorComposable() {
selectedPlacedObject,
shouldClearTiles,
teleportSettings,
refreshMapObject,
// Methods
loadMap,
@ -115,6 +127,7 @@ export function useMapEditorComposable() {
setTeleportSettings,
triggerClearTiles,
resetClearTilesFlag,
triggerMapObjectRefresh,
reset
}
}