#96 - Renamed and refactored pointer handler composables in favor of arrow key movement.

This commit is contained in:
2025-01-31 22:26:23 +01:00
parent 0f46e3b6d2
commit 7d3946e274
11 changed files with 187 additions and 245 deletions

View File

@ -27,28 +27,20 @@ function handlePointer(pointer: Phaser.Input.Pointer) {
// Check if left mouse button is pressed
if (!pointer.isDown) return
// Check if shift is not pressed, this means we are moving the camera
if (pointer.event.shiftKey) return
// Check if shift is pressed or if we're in move mode, this means we are moving the camera
if (pointer.event.shiftKey || mapEditor.tool.value === 'move') return
// Check if draw mode is tile
switch (mapEditor.drawMode.value) {
case 'tile':
mapTiles.value.handlePointer(pointer)
break
case 'object':
mapObjects.value.handlePointer(pointer)
case 'teleport':
break
case 'event':
eventTiles.value.handlePointer(pointer)
break
}
}
onMounted(() => {
scene.input.on(Phaser.Input.Events.POINTER_MOVE, handlePointer)
scene.input.on(Phaser.Input.Events.POINTER_DOWN, handlePointer)
})
onUnmounted(() => {
scene.input.off(Phaser.Input.Events.POINTER_MOVE, handlePointer)
scene.input.off(Phaser.Input.Events.POINTER_DOWN, handlePointer)
mapEditor.reset()
})
</script>