-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
Don't reuse old requestedCameraState. #4243
Don't reuse old requestedCameraState. #4243
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4243 +/- ##
==========================================
- Coverage 87.73% 87.48% -0.25%
==========================================
Files 242 242
Lines 33081 33077 -4
Branches 2160 2184 +24
==========================================
- Hits 29023 28937 -86
- Misses 3088 3149 +61
- Partials 970 991 +21 ☔ View full report in Codecov by Sentry. |
All tests are passing, meaning who ever added this code didn't add a test to make sure this behavior is kept. |
@Pessimistress Seems to be your code, do you remember why you added this and if it's safe to remove? |
Okay, I'm still not sure why requestedCameraState is kept, but Camera.easeTo seems to ignore it at some points and instead uses the original transform (that is not yet updated). So it uses states of two different transforms to calculate things, which seems to lead to this (and other?) bugs. Needs some more tests. |
As far as I understand it correctly, the only reason for Still not 100 percent sure, but this is as far I can get without feedback or some real world usage examples (could not find any at all). It's not even used in Added a commit to delete the |
@Pessimistress @birkskyum can you help here? |
@chrneumann can you add a test to simulate the bugs you experience? This way at least we'd know if we change the solution that the original issue is still fixed. |
Your change will break the In short, only maplibre-gl-js/src/ui/camera.ts Lines 1073 to 1089 in a3f67eb
|
@Pessimistress Do you have an example/test of your use case or how this breaks it? |
https://codepen.io/Pessimistress/pen/xxNPvVr I apologize for not adding a unit test for this use case. I can open a PR if that helps. (I may need some guidance on how to simulate user input) |
Thanks, that makes it clearer. But the example seems to have an issue: it's not possible to drag pan the map while the map is still moving because of inertia of a last drag pan. Can't reproduce the problem without the |
@chrneumann can you please provide test that reproduces the issue that this PR solves? We need two tests here basically:
This requires a test from each one of you so that when both tests are fixed we'd know we can merge the change. If there's a need for me to create a branch in this repo to facilitate for this work please let me know. |
See #4299. |
Found an other way to fix the issue in #4299. Still, a use case / test for the React use case is missing. |
Fixes unexpected camera jumps when transformCameraUpdate is specified and user is panning on maps with terrain (Fixes #4233).
Camera._getTransformForUpdate clones the transform on first call. After that, it is reused on later calls. I am not sure why, maybe only performance reasons? If the transform is cloned on every call (as changed by the PR), the jumps are gone. Could not find any problems yet and the tests run fine. Maybe I overlooked something.
Launch Checklist
CHANGELOG.md
under the## main
section.