return if shift is pressed for tiles, objects and event tiles (camera drag = active)

This commit is contained in:
Dennis Postma 2024-10-19 22:36:08 +02:00
parent 1aa07daa35
commit 6adfc727c5
3 changed files with 18 additions and 0 deletions

View File

@ -39,6 +39,9 @@ function pencil(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 there is a tile
const tile = getTile(props.tilemap, pointer.worldX, pointer.worldY)
if (!tile) return
@ -84,6 +87,9 @@ function eraser(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 there is a tile
const tile = getTile(props.tilemap, pointer.worldX, pointer.worldY)
if (!tile) return

View File

@ -51,6 +51,9 @@ function pencil(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 there is a tile
const tile = getTile(props.tilemap, pointer.worldX, pointer.worldY)
if (!tile) return
@ -88,6 +91,9 @@ function eraser(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 there is a tile
const tile = getTile(props.tilemap, pointer.worldX, pointer.worldY)
if (!tile) return

View File

@ -62,6 +62,9 @@ function pencil(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 there is a tile
const tile = getTile(tiles, pointer.worldX, pointer.worldY)
if (!tile) return
@ -86,6 +89,9 @@ function eraser(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 there is a tile
const tile = getTile(tiles, pointer.worldX, pointer.worldY)
if (!tile) return