ikaruga 0 Report post Posted August 4, 2020 Here's the code in question: https://pixijs.io/examples/#/interaction/dragging.js bunny .on('pointerdown', onDragStart) .on('pointermove', onDragMove); function onDragStart(event) { // store a reference to the data // the reason for this is because of multitouch // we want to track the movement of this particular touch this.data = event.data; } // this is the example onDragMove function onDragMove() { if (this.dragging) { const newPosition = this.data.getLocalPosition(this.parent); this.x = newPosition.x; this.y = newPosition.y; } } // why doesn't this work? function onDragMoveModified(event) { if (this.dragging) { const newPosition = event.data.getLocalPosition(this.parent); this.x = newPosition.x; this.y = newPosition.y; } } As per the docs for the InteractionEvent, the `event.data` presumably has the data for the current drag event. https://pixijs.download/dev/docs/PIXI.InteractionEvent.html Can someone explain to me why we have to store the start `event.data` in the current object? I don't understand why using the latest event (as in onDragMoveModified) doesn't work? To clarify, when you try that code, the result is jumpiness on multi touch Quote Share this post Link to post Share on other sites
jonforum 90 Report post Posted August 5, 2020 in most case you will maybe prefer bind the objet, or pass this if you use classes bunny.on("onDragStart",onDragStart,bunny); Quote Share this post Link to post Share on other sites
leeda 1 Report post Posted August 6, 2020 onDragMoveModified does not seem to be listen. .on('pointermove', onDragMoveModified); Quote Share this post Link to post Share on other sites