phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Drag move events triggered even after the GameObject is destroyed

Open laineus opened this issue 1 year ago • 0 comments

Version

  • Phaser Version: v3.55.2
  • Operating system: Linux
  • Browser: Google Chrome 109.0.5414.74

Description

Drag move event continues to be executed after the GameObject is destroyed.

Example Test Code

Minimal example: https://codepen.io/laineus/pen/zYmYXrM

This issue happens only when touch event. not happens on mouse event, so you need to try the example with device emulator of chrome devtools.

  1. switch to mobile emulator of devtool and reload the page
  2. drag the red box and move it to bottom
  3. the box is destroyed
  4. keep dragging
  5. errors shows up in console
properties of undefined (reading 'target')
    at InputPlugin.processDragMoveEvent (phaser.js:186357:32)
    at InputPlugin.update (phaser.js:185831:35)
    at InputManager.updateInputPlugins (phaser.js:93090:47)
    at InputManager.onTouchMove (phaser.js:93178:14)
    at HTMLCanvasElement.onTouchMove (phaser.js:96211:31)

Additional Information

The error happens on this line of InputPlugin: https://github.com/photonstorm/phaser/blob/master/src/input/InputPlugin.js#L1294

Thank you.

laineus avatar Apr 07 '23 07:04 laineus