Proper touch pinch support for Zoom & Pan#21655
Open
NightRa wants to merge 4 commits into
Open
Conversation
|
Thanks for your contribution! Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Brief Information
This pull request is in the type of:
What does this PR do?
Improve
RoamControllerpinch handling by using the real touch pinch scale, supporting two-finger pan, and capturing pinch gestures consistently.Fixed issues
Fixes #18949
Fixes #18113
Related #21417
Related #20939
Details
Before: What was the problem?
Touch pinch zoom used a fixed zoom step:
This made small frame-to-frame pinch changes to zoom exponentially instead of according to the pinch distance.
Pinch also emitted only zoom events. When the pinch center moved, roamable views did not pan with the fingers. Additionally, pinch hit-testing was repeated on every frame, so an active pinch could stop when moving outside the roam area, or be picked up mid-gesture by another overlapping
RoamController.After: How does it behave after the fixing?
RoamControllernow uses the actuale.pinchScalereported by ZRender.Pinch is treated as a two-finger roam gesture:
roam: true: pinch can pan and zoom.roam: 'move'/'pan': pinch can pan without zooming.roam: 'scale'/'zoom': pinch can zoom without panning.A pinch is captured only when it starts from a native
touchstartinside the valid roam area. Once captured, it continues outside the area like mouse drag, and anotherRoamControllercannot pick up the already-moving pinch.Document Info
Misc
Security Checking
ZRender Changes
Related test cases or examples to use the new APIs
Manual examples:
test/dataZoom-timeAxis.htmldataZoom-rainfall-inside.htmltest/geo-map-roam.htmltest/graph-layout-roam.htmltest/tree-roam.htmltest/sankey-roam.htmltest/treemap-simple.htmltest/treemap-scaleLimit.htmltest/graph-thumbnail.htmlI've tested the changes in all the mentioned test examples on an Android phone in Chrome.
Merging options
Before & After videos
dataZoom-Before.mp4
dataZoom-After.mp4
Geo-Before.mp4
Geo-After.mp4