Hi, I have a drag end event in my program, and I get this error when I try to drag something out of the screen:
Uncaught TypeError: Cannot read property ‘renderList’ of undefined
This error happens when the ‘dragend’ event triggers when the pointer is outside of this. I think this could be affecting the flow of the program a little bit, and if someone could tell me how to avoid this could be great.
This is the full error:
Uncaught TypeError: Cannot read property ‘renderList’ of undefined
at InputPlugin.sortGameObjects (phaser.js:187734)
at InputPlugin.processOverOutEvents (phaser.js:186899)
at InputPlugin.update (phaser.js:185813)
at InputManager.updateInputPlugins (phaser.js:93090)
at InputManager.onMouseUp (phaser.js:93320)
at onMouseUpWindow (phaser.js:94514)
The ‘dragend’ event validates where the pointer is and if is offscreen it just moves the object to a certain position, it also adds a little bit of momentum just to be more visually attractive.
Also, the timeClicked variable is used to differentiate between a drag and a click
This bug has only come up a couple of times and it’s really hard to replicate (last time I just randomly clicked and dragged the scene).
zone.js:1777 Uncaught TypeError: Cannot read properties of undefined (reading 'renderList')
at initialize.sortGameObjects (phaser.js:187734:35)
at initialize.processOverOutEvents (phaser.js:186899:18)
at initialize.update (phaser.js:185813:35)
at initialize.updateInputPlugins (phaser.js:93090:47)
at initialize.onMouseUp (phaser.js:93320:14)
at onMouseUpWindow (phaser.js:94514:25)
at rn.___hb (browser.ts:175:25)
at q.invokeTask (zone.js:443:35)
at q.runTask (zone.js:214:51)
at q.invokeTask [as invoke] (zone.js:525:38)
sortGameObjects: function (gameObjects, pointer)
{
if (gameObjects.length < 2)
{
return gameObjects;
}
var list = pointer.camera.renderList; // <--- Here
return gameObjects.sort(function (childA, childB)
{
return list.indexOf(childB) - list.indexOf(childA);
});
},