diff options
-rw-r--r-- | src/mbgl/map/transform.cpp | 2 | ||||
-rw-r--r-- | test/map/transform.test.cpp | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/mbgl/map/transform.cpp b/src/mbgl/map/transform.cpp index 5854eaea37..7d3c9d8b74 100644 --- a/src/mbgl/map/transform.cpp +++ b/src/mbgl/map/transform.cpp @@ -124,7 +124,7 @@ void Transform::easeTo(const CameraOptions& camera, const AnimationOptions& anim const double startScale = state.scale; const double startAngle = state.angle; const double startPitch = state.pitch; - state.panning = latLng != startLatLng; + state.panning = unwrappedLatLng != startLatLng; state.scaling = scale != startScale; state.rotating = angle != startAngle; diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp index eb511a82da..7e98863400 100644 --- a/test/map/transform.test.cpp +++ b/test/map/transform.test.cpp @@ -468,6 +468,23 @@ TEST(Transform, Camera) { ASSERT_DOUBLE_EQ(transform.getLatLng().longitude(), 0); } +TEST(Transform, IsPanning) +{ + Transform transform; + + AnimationOptions easeOptions(Seconds(1)); + easeOptions.transitionFrameFn = [&transform](double) { + ASSERT_TRUE(transform.getState().isPanning()); + }; + + transform.resize({ 1000, 1000 }); + transform.easeTo(CameraOptions().withCenter(LatLng(0, 360.0)), easeOptions); + transform.updateTransitions(transform.getTransitionStart() + Milliseconds(250)); + transform.updateTransitions(transform.getTransitionStart() + Milliseconds(500)); + transform.updateTransitions(transform.getTransitionStart() + Milliseconds(750)); + transform.updateTransitions(transform.getTransitionStart() + transform.getTransitionDuration()); +} + TEST(Transform, DefaultTransform) { struct TransformObserver : public mbgl::MapObserver { void onCameraWillChange(MapObserver::CameraChangeMode) final { |