diff --git a/src/components/utilities/zoneEditor/Toolbar.vue b/src/components/utilities/zoneEditor/Toolbar.vue index e3182f0..79093ff 100644 --- a/src/components/utilities/zoneEditor/Toolbar.vue +++ b/src/components/utilities/zoneEditor/Toolbar.vue @@ -66,8 +66,10 @@ watch(drawMode, (value) => { zoneEditorStore.setDrawMode(value) }) -function drawTiles(pointer: Phaser.Input.Pointer) { - if (!pointer.isDown) return +function drawTile(pointer: Phaser.Input.Pointer) { + if (zoneEditorStore.tool !== 'eraser' && zoneEditorStore.tool !== 'pencil') { + return + } const px = scene.cameras.main.worldView.x + pointer.x const py = scene.cameras.main.worldView.y + pointer.y @@ -86,9 +88,16 @@ function drawTiles(pointer: Phaser.Input.Pointer) { } } +function drawTiles(pointer: Phaser.Input.Pointer) { + if (!pointer.isDown) return + drawTile(pointer) +} + +scene.input.on(Phaser.Input.Events.POINTER_UP, drawTile) scene.input.on(Phaser.Input.Events.POINTER_MOVE, drawTiles) onBeforeUnmount(() => { + scene.input.off(Phaser.Input.Events.POINTER_UP, drawTile) scene.input.off(Phaser.Input.Events.POINTER_MOVE, drawTiles) }) diff --git a/src/screens/Game.vue b/src/screens/Game.vue index 4f1dad2..e8a0ab1 100644 --- a/src/screens/Game.vue +++ b/src/screens/Game.vue @@ -53,7 +53,7 @@ const gameConfig = { name: 'New Quest', width: window.innerWidth, height: window.innerHeight, - type: Phaser.CANVAS, + type: Phaser.AUTO, pixelArt: true }