#96 - Renamed and refactored pointer handler composables in favor of arrow key movement.
This commit is contained in:
@ -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>
|
||||
|
Reference in New Issue
Block a user