Skip to content
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

transformCameraUpdate leads to unexpected camera jumps when targetting terrain #4233

Closed
chrneumann opened this issue Jun 5, 2024 · 2 comments · Fixed by #4299
Closed

transformCameraUpdate leads to unexpected camera jumps when targetting terrain #4233

chrneumann opened this issue Jun 5, 2024 · 2 comments · Fixed by #4299
Labels
bug Something isn't working PR is more than welcomed Extra attention is needed Terrain 3D

Comments

@chrneumann
Copy link
Contributor

chrneumann commented Jun 5, 2024

maplibre-gl-js version: 4.3.2

browser: Firefox 126, Chrome 125

Steps to Trigger Behavior

  1. Use the 3D-terrain example
  2. Add a transformCameraUpdate function in the options that returns the input or an empty object.
  3. Drag pan the map a little bit (inertia must be triggered). After end of drag, the jump happens.
  4. After the jump, it works fine until the terrain is targetted again with the camera.

Link to Demonstration

https://jsbin.com/pobidixeqa/1/edit?html,output

Expected Behavior

The empty ((tr)=>({}) or identity (tr)=>tr transformCameraUpdate option should never have an effect on the camera movement.

Actual Behavior

The camera jumps to a different location when drag panning with triggered inertia and terrain targeted.

@HarelM
Copy link
Member

HarelM commented Jun 5, 2024

Terrain movement changes the zoom at the end, I guess the fact that there is a trasform being kept and then applied at the end collides with how terrain works.
Feel free to dig into it.

@chrneumann
Copy link
Contributor Author

Fix available in #4299.

HarelM added a commit that referenced this issue Jul 12, 2024
* Add test for camera jumps with terrain and transformCameraUpdate.

Test for #4233.

* Fix terrain jumps with transformCameraUpdate (#4233).

* Refactor test.

* Simplify terrain browser test.

* Add unit test for zoom recalculation with transformCameraUpdate.

* Fix expected value in unit test.

---------

Co-authored-by: Harel M <harel.mazor@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR is more than welcomed Extra attention is needed Terrain 3D
Projects
None yet
2 participants