diff --git a/src/components/utilities/Controls.vue b/src/components/utilities/Controls.vue index 59530a4..fab14f7 100644 --- a/src/components/utilities/Controls.vue +++ b/src/components/utilities/Controls.vue @@ -9,6 +9,7 @@ import { storeToRefs } from 'pinia' import config from '@/config' import { getTile, tileToWorldXY } from '@/services/zone' import { useZoneEditorStore } from '@/stores/zoneEditor' +import { useGameStore } from '@/stores/game' const props = defineProps<{ layer: Phaser.Tilemaps.TilemapLayer @@ -16,6 +17,7 @@ const props = defineProps<{ const scene = useScene() const zoneEditorStore = useZoneEditorStore() +const gameStore = useGameStore() const { tool } = storeToRefs(zoneEditorStore) const waypoint = ref({ @@ -63,11 +65,13 @@ function setupEventListeners() { scene.input.on(Phaser.Input.Events.POINTER_DOWN, (pointer: Phaser.Input.Pointer) => { if (pointer.event.altKey || tool.value === 'move') { + gameStore.setMovingCamera(true) scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone) } }) scene.input.on(Phaser.Input.Events.POINTER_UP, () => { + gameStore.setMovingCamera(false) scene.input.off(Phaser.Input.Events.POINTER_MOVE, dragZone) }) } diff --git a/src/components/utilities/assetManager/partials/ObjectDetails.vue b/src/components/utilities/assetManager/partials/ObjectDetails.vue index 2b4ee2e..df25dce 100644 --- a/src/components/utilities/assetManager/partials/ObjectDetails.vue +++ b/src/components/utilities/assetManager/partials/ObjectDetails.vue @@ -39,7 +39,7 @@ diff --git a/src/stores/game.ts b/src/stores/game.ts index 9f2c9d2..c44d8e1 100644 --- a/src/stores/game.ts +++ b/src/stores/game.ts @@ -11,7 +11,8 @@ export const useGameStore = defineStore('game', { connection: null as Socket | null, user: null as User | null, character: null as Character | null, - isGmPanelOpen: false + isGmPanelOpen: false, + isMovingCamera: false }), actions: { setScreen(screen: string) { @@ -29,6 +30,12 @@ export const useGameStore = defineStore('game', { toggleGmPanel() { this.isGmPanelOpen = !this.isGmPanelOpen }, + toggleMovingCamera() { + this.isMovingCamera = !this.isMovingCamera + }, + setMovingCamera(moving: boolean) { + this.isMovingCamera = moving + }, initConnection() { this.connection = io(config.server_endpoint, { secure: !config.development, diff --git a/src/stores/zoneEditor.ts b/src/stores/zoneEditor.ts index 9b1a609..113c860 100644 --- a/src/stores/zoneEditor.ts +++ b/src/stores/zoneEditor.ts @@ -1,4 +1,5 @@ import { defineStore } from 'pinia' +import { useGameStore } from '@/stores/game'; import type { Zone, Object, Tile, ZoneObject } from '@/types' export const useZoneEditorStore = defineStore('zoneEditor', { @@ -62,6 +63,9 @@ export const useZoneEditorStore = defineStore('zoneEditor', { this.selectedObject = object }, setSelectedZoneObject(zoneObject: ZoneObject) { + const gameStore = useGameStore(); // Access the gameStore + if (gameStore.isMovingCamera) return; // Step 2: Check isMovingCamera before proceeding + this.selectedZoneObject = zoneObject }, setObjectDepth(depth: number) {