forked from noxious/client
small logic improvement
This commit is contained in:
parent
ad94928370
commit
a308696cf2
@ -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)
|
||||
})
|
||||
|
||||
|
@ -53,7 +53,7 @@ const gameConfig = {
|
||||
name: 'New Quest',
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
type: Phaser.CANVAS,
|
||||
type: Phaser.AUTO,
|
||||
pixelArt: true
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user