Round tap-zoom gestures to nearest integer#8027
Conversation
|
@friedbunny, thanks for your PR! By analyzing this pull request, we identified @incanus, @1ec5 and @jfirebaugh to be potential reviewers. |
b64d9cb to
de6d862
Compare
There was a problem hiding this comment.
Can you make the corresponding changes to the Zoom In and Zoom Out buttons in the Android and macOS SDKs?
mapbox-gl-native/platform/macos/src/MGLMapView.mm
Line 1045 in e6c15d0
/cc @tobrun
There was a problem hiding this comment.
Went a bit further on macOS in 4ed80f9 and rounded all of the non-freeform zoom methods gestures and commands.
bb07128 to
4ed80f9
Compare
1ec5
left a comment
There was a problem hiding this comment.
Looks good, and thanks also for the changes on the macOS side. I’ll leave it to you to decide whether the Android SDK should get this fix here or in a separate PR.
There was a problem hiding this comment.
FYI, the ⌥↑ and ⌥↓ shortcuts are built into MGLMapView. The menu items (which have their own shortcuts) are defined in MapDocument but could conceivably be moved into MGLMapView as well.
There was a problem hiding this comment.
Ah, did not know that — I’ll update the text here.
Round double-tap and two-finger tap zoom gestures to the nearest integer zoom level. This has the benefits for raster tiles, as well as styles with zoom-based functions. This results in a wider possible zoom range — ~0.5-1.5: Old: z4.6 → z5.6 (+1.0), z4.4 → z5.4 (+1.0) New: z4.6 → z6.0 (+1.4), z4.4 → z5.0 (+0.6)
4ed80f9 to
b27ace8
Compare
Affects: - Double-tap gestures - Two-finger tap gestures - +/- button pushes - Shortcut keys - Menu items and shortcut keys (in macapp)
b27ace8 to
4b227ed
Compare
|
@1ec5 @friedbunny I initially created that PR to showcase the possibility of such a feature but this didn't make it to master at that time as I didn't want to change the "default" behaviour. We could definitely look into reopening it for consistency between the bindings. cc @mapbox/android |
Yeah, let's do that for 5.0. It doesn't look like a big lift. |
|
The Android side is happening once again in #7630. 🚢 |

iOS changes
Rounds double-tap and two-finger tap zoom gestures to the nearest integer zoom level. This has benefits for raster tiles, as well as styles with zoom-based functions that transition on integers.
This results in a wider possible zoom range per gesticulation — 1.0 → ~0.5-1.5 levels. Here’s a comparison of double-tapping to zoom in with the changes in this PR:
Fixes #2276.
Core changes
Exposes an already-existing
setZoomvariation that takes ananchorparameter — I did this to avoid calculating scale levels in the iOS zoom code. This makesMap::setZoom(zoom, {}, duration)ambiguous, so it’s now necessary to specify a type for the middle parameter.