-
-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: [issue-2238] stop camera animation on mac when reduced motion is on #3068
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #3068 +/- ##
=======================================
Coverage 75.06% 75.06%
=======================================
Files 240 240
Lines 19134 19135 +1
Branches 4320 4320
=======================================
+ Hits 14363 14364 +1
Misses 4771 4771
☔ View full report in Codecov by Sentry. |
Can you elaborate why setting arond to center solves this issue? |
Hi @HarelM, thanks for the feedback. The description was updated. While I was writing it, another approach came to my mind. |
I think I would like to avoid calling easeTo in case of reduced motion, seems cleaner to me... |
038a3f1
to
b165fef
Compare
@HarelM as you said, avoiding easeTo (inertia animation) results in cleaner code. note: some tests failed, but it seems like something unrelated to this pr. |
Unfortunately, the tests are flaky, not sure how to solve this... :-( |
8a87374
to
5cdf538
Compare
5cdf538
to
e41dc5b
Compare
Now the test drag map check behavior with and without reduced motion feature |
Looks great and super clean, THANKS! |
To fix issue #2238, this PR modifies the camera animation behavior on Mac when the 'reduced motion' setting is on.
Explanation:
The camera.easeTo method is called after the map movement happens, in order to add if needed a kind of "inertia movement". The easeTo method is called with the around property option with the position that should be the end of the camera ease movement.
Currently, when the 'reduced motion' setting is on, the duration is changed by 0. This does not avoid the final result, it only avoids the animation, because the final result will be at the around position, so it looks like an unexpected jump.
Example of the current behaviour, another example can be found here #2238
issue-2238-main.mp4
Approaches to fix
My first approach was to just
return this;
if the reduced motion was on, but that approach didn't work well because it broke the zoom when the method was called by a double click.Another approach can be to reassign the around property to the center, because as was said before the movement was already done, and the center is in the current position, so the following code in the method will try as usual to do a movement, but its start position will be equal to the end position, so no movement will occur at all.
This PR approach avoids calling this method when reduced motion is on
Result with this approach
issue-2238.mp4
Launch Checklist
CHANGELOG.md
under the## main
section.