-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] - allow zooming/scaling to use AnimationOptions #8181
Conversation
@tobrun, thanks for your PR! By analyzing this pull request, we identified @1ec5, @jfirebaugh and @zugaldia to be potential reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised the macOS SDK built without errors following this change, but apparently it works because mbgl::AnimationOptions
has a constructor that takes an mbgl::Duration
. So this is a pretty elegant change.
include/mbgl/map/map.hpp
Outdated
void setZoom(double zoom, optional<EdgeInsets>, const Duration& = Duration::zero()); | ||
void setZoom(double zoom, const AnimationOptions& = {}); | ||
void setZoom(double zoom, optional<ScreenCoordinate>, const AnimationOptions& = {}); | ||
void setZoom(double zoom, optional<EdgeInsets>, const AnimationOptions& = {}); | ||
double getZoom() const; | ||
void setLatLngZoom(const LatLng&, double zoom, const Duration& = Duration::zero()); | ||
void setLatLngZoom(const LatLng&, double zoom, optional<EdgeInsets>, const Duration& = Duration::zero()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about changing these other zoom-related methods too, for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great catch, let me add those as well
ded7d12
to
839ddeb
Compare
How about making this change universally in map.hpp? |
13478b6
to
b6aa887
Compare
Requested changes have been implemented (resulted in changing some GLFW code) and were rebased on @ivovandongen JNI refactor PR for #6533. Can I get another round of 👀? |
b6aa887
to
75a2d2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Good to merge after fixing a tiny nit.
src/mbgl/map/transform_state.cpp
Outdated
@@ -1,4 +1,4 @@ | |||
#include <mbgl/map/transform_state.hpp> | |||
#include <mbgl/map/transform_state.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidental added whitespace.
[glfw] - allow glfw binding to use AnimationOptions instead of using direction directly
75a2d2b
to
471c80c
Compare
nit was fixed, merging. |
This PR enables to use AnimationOptions when performing a zoom/scale transformation (equivalent to #8092 for moveBy). This allows bindings to use an interpolator while doing a zoom/scale transformation.
To showcase the possibilities with this API, here is an example of the double tap zoom gesture using the
easeInOutBack
interpolator with an increased duration:Note that atm I'm not changing the default behaviour for Android.