the following is in my scene.update section:
scene.input.on(‘dragstart’, function (pointer, gameObject) {
gameObject.setTint(0xff0000);
});
scene.input.on(‘drag’, function (pointer, gameObject, dragX, dragY) {
gameObject.x = dragX;
gameObject.y = dragY;
gameObject.setDepth (dragY+(gameObject.height/2));
});
scene.input.on(‘dragend’, async function (pointer, gameObject) {
gameObject.clearTint();
console.log(gameObject.texture.key);
});
The ‘dragend’ event seems to fire for each time ‘drag’ has been fired.
Is there a better function to call that will fire only once at the end of dragging? Right now, dragend is invoked hundreds or thousands of times when dragging stops.