From 8bbfb867ae2ac2b0fd18b421285c3245f87f23e0 Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Thu, 11 Jul 2024 18:42:06 +0200 Subject: [PATCH] Added key bindings to zone editor --- .../utilities/zoneEditor/Toolbar.vue | 36 ++++++++++++++++--- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/components/utilities/zoneEditor/Toolbar.vue b/src/components/utilities/zoneEditor/Toolbar.vue index 924ff96..5077a52 100644 --- a/src/components/utilities/zoneEditor/Toolbar.vue +++ b/src/components/utilities/zoneEditor/Toolbar.vue @@ -3,13 +3,13 @@
@@ -151,4 +151,30 @@ onBeforeUnmount(() => { scene.input.off(Phaser.Input.Events.POINTER_UP, drawTile) scene.input.off(Phaser.Input.Events.POINTER_MOVE, drawTiles) }) + + +// Key bindings +const keyDown = (event: KeyboardEvent) => { + if (event.key === 'm') { + zoneEditorStore.setTool('move') + } + + if (event.key === 'p') { + zoneEditorStore.setTool('pencil') + } + + if (event.key === 'e') { + zoneEditorStore.setTool('eraser') + } + + if (event.key === 'b') { + zoneEditorStore.setTool('paint') + } + + if (event.key === 's') { + zoneEditorStore.toggleSettingsModal() + } +} + +addEventListener('keydown', keyDown)