summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/map/transform.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp
index 29fa7c9eb2..b283251431 100644
--- a/src/mbgl/map/transform.cpp
+++ b/src/mbgl/map/transform.cpp
@@ -77,7 +77,8 @@ void Transform::jumpTo(const CameraOptions& camera) {
* not included in `options`.
*/
void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& animation) {
- const LatLng latLng = camera.center.value_or(getLatLng()).wrapped();
+ const LatLng unwrappedLatLng = camera.center.value_or(getLatLng());
+ const LatLng latLng = unwrappedLatLng.wrapped();
double zoom = camera.zoom.value_or(getZoom());
double angle = camera.angle.value_or(getAngle());
double pitch = camera.pitch.value_or(getPitch());
@@ -89,8 +90,13 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim
// Determine endpoints.
EdgeInsets padding;
if (camera.padding) padding = *camera.padding;
- LatLng startLatLng = getLatLng(padding).wrapped();
- startLatLng.unwrapForShortestPath(latLng);
+ LatLng startLatLng = getLatLng(padding);
+ // If gesture in progress, we transfer the world rounds from the end
+ // longitude into start, so we can guarantee the "scroll effect" of rounding
+ // the world while assuring the end longitude remains wrapped.
+ if (isGestureInProgress()) startLatLng.longitude -= unwrappedLatLng.longitude - latLng.longitude;
+ // Find the shortest path otherwise.
+ else startLatLng.unwrapForShortestPath(latLng);
const ScreenCoordinate startPoint = {
state.lngX(startLatLng.longitude),