asset mngr stuff
This commit is contained in:
@ -10,8 +10,8 @@ import { getTile, tileToWorldXY } from '@/services/zone'
|
||||
import { useZoneStore } from '@/stores/zone'
|
||||
import { useZoneEditorStore } from '@/stores/zoneEditor'
|
||||
|
||||
const zoneStore = useZoneStore();
|
||||
const zoneEditorStore = useZoneEditorStore();
|
||||
const zoneStore = useZoneStore()
|
||||
const zoneEditorStore = useZoneEditorStore()
|
||||
const scene = useScene()
|
||||
const props = defineProps({
|
||||
layer: Phaser.Tilemaps.TilemapLayer
|
||||
@ -43,7 +43,7 @@ function onPointerMove(pointer: Phaser.Input.Pointer) {
|
||||
scene.input.on(Phaser.Input.Events.POINTER_MOVE, onPointerMove)
|
||||
|
||||
// Zone camera system
|
||||
function dragZone (pointer: Phaser.Input.Pointer) {
|
||||
function dragZone(pointer: Phaser.Input.Pointer) {
|
||||
if (!pointer.isDown) return
|
||||
cam.scrollX -= (pointer.x - pointer.prevPosition.x) / cam.zoom
|
||||
cam.scrollY -= (pointer.y - pointer.prevPosition.y) / cam.zoom
|
||||
@ -52,14 +52,16 @@ let cam = scene.cameras.main
|
||||
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
|
||||
|
||||
watch(
|
||||
() => zoneEditorStore.tool, () => {
|
||||
() => zoneEditorStore.tool,
|
||||
() => {
|
||||
// @TODO : change to zone for when loading other maps
|
||||
if (zoneEditorStore.tool === 'move') {
|
||||
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
|
||||
} else {
|
||||
scene.input.off(Phaser.Input.Events.POINTER_MOVE, dragZone)
|
||||
}
|
||||
}, { deep: true }
|
||||
if (zoneEditorStore.tool === 'move') {
|
||||
scene.input.on(Phaser.Input.Events.POINTER_MOVE, dragZone)
|
||||
} else {
|
||||
scene.input.off(Phaser.Input.Events.POINTER_MOVE, dragZone)
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
// Unload funcs
|
||||
|
Reference in New Issue
Block a user