This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
[android] - limit the scale factor for double tap zoom - #7580
Merged
Merged
Conversation
zugaldia
reviewed
Jan 3, 2017
| // around center map | ||
| transform.zoomBy(detector.getScaleFactor(), uiSettings.getWidth() / 2, uiSettings.getHeight() / 2); | ||
| float scaleFactor = detector.getScaleFactor(); | ||
| if (scaleFactor > 0.65 && scaleFactor < 1.35) { |
Member
There was a problem hiding this comment.
@tobrun I like the approach of limiting the values provided by the gesture library to handle this behavior. Two thoughts:
- We're currently skipping updates when the
scaleFactoris outside range. Wouldn't it work more smoothly if weclampthe value to the[min ,max]range? - Why are we choosing
0.65and1.35as the cutoff values?
Member
Author
There was a problem hiding this comment.
- yes, will be smoother, I initially left this out because I was seeing negative values and thought that clamping those would give a reversed zoom, but after investigating these occurrences it's always followed with values resembling a reverse zoom so clamping here is valid.
01-03 18:13:12.049 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: Before 0.70612484
01-03 18:13:12.050 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: After 0.70612484
01-03 18:13:12.066 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: Before 0.994616
01-03 18:13:12.067 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: After 0.994616
01-03 18:13:12.081 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: Before -0.1821847
01-03 18:13:12.082 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: After 0.65
01-03 18:13:12.100 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: Before 0.623573
01-03 18:13:12.101 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: After 0.65
01-03 18:13:12.120 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: Before 0.7911937
01-03 18:13:12.121 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: After 0.7911937
01-03 18:13:12.134 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: Before 0.88355064
01-03 18:13:12.135 18481-18481/com.mapbox.mapboxsdk.testapp E/MapGestureDetector$ScaleGestureListener: After 0.88355064
- purely based on values I'm seeing locally here on 3 devices. I have now moved them to the MapboxConstants file. FWIW the 0.65 value is the maximum scale we can zoom out, the 1.35 resembls the maximum scale we can zoom in. Feel free to test out changing these values while testing out this PR.
cammace
approved these changes
Jan 3, 2017
cammace
left a comment
Contributor
There was a problem hiding this comment.
👍 Tested on device and looks good to merge
cammace
pushed a commit
that referenced
this pull request
Jan 25, 2017
* [android] - limit the scale factor to avoid accelerating the double tap zoom gesture * clamp values
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #7514, more information here.
Review @cammace