workaround for minecraft pointerevent bug on chromeos #10265
Merged
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.
fixes https://github.com/microsoft/pxt-minecraft/issues/2622
the issue here was that minecraft on chromeos was dropping pointerup events whenever a multitouch gesture was used on the trackpad. blockly tracks what pointers are currently still "down", so if a pointerup event goes missing then it will get stuck forever thinking that it is within a multitouch gesture even when there are no fingers still on the trackpad.
to fix this, i had to monkey patch blockly's gesture class to prevent it from tracking multiple pointers on chromeos. essentially, this patch filters all pointer events for all fingers except whichever went down first. all pointerup events are let through, however, which allows the user to get out of a stuck gesture by simply doing another click or drag on the workspace. hopefully that's the first thing they will intuitively try to do when the workspace gets stuck to the cursor.
a proper fix for this issue would be to investigate why the pointer events are being dropped by minecraft (or the android webview). but that would take longer and require a minecraft release, so this hack will have to do for now. blockly could also stand to be a little more fault-tolerant when it comes to gestures.