Fix: Android Multi touch interaction fixes #10151
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
Problem:
On Android devices, when a user interacts with a pinch zoom (multi-touch interaction), it works for the first time and then stops working subsequently. There were a couple of open issues in pixi-viewport that discuss this problem
Demo:
WhatsApp.Video.2024-01-24.at.10.38.58.PM.mp4
Solution:
In @pixi/interaction package, we have interactionDataPool. When a tap occurs, we create an InteractionData object. And when it is released, we push this object to the array for future use in function
getInteractionDataForPointerId
Now, if the
pointerId == MOUSE_POINTER_ID
,the interactionData isthis.mouse
. This gets pushed to the interaction pool on release. In future touches, this data gets manipulated and identifier gets to 0 because of the following code:Solution:
If the interaction data is this.mouse, we do not push it to interactionDataPool. We check this by comparing the pointerId of the interaction data
Pre-Merge Checklist
npm run lint
)npm run test
)