-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
When simulating a GPS bearing the map zooms in/out with terrain #3878
Comments
This is the first bounty we are defining. |
Don't _finalizeElevation if freezeElevation has not been set. This means that elevation logic has two distinct operating modes. Mode one - freezeElevation is false - default: - updateElevation is called continuously during the movement - finalizeElevation is *not* called at the end. Mode two - freezeElevation is true: - updateElevation is *not* called continuoulsy during the movement - finalizeElevation is called at the end. Previously, both methods were called in mode one, which lead to issue maplibre#3878 if freezeElevation was not set.
You could argue that this is "working as intended" but certainly it is a bit indicative on the code here having gotten away from us over time, probably due to 3d terrain being added onto a system that wasn't originally designed for it (nobody's fault). Simplest fix:
Simplest fix is applied here: So, that's why you could argue that this is okay - the documentation says this boolean should be set in a 3D map, and this is a 3D map, and if you set the boolean, things work okay. The documentation doesn't say what will happen if you forget to set the boolean, but it turns out, that this bug is what happens. However, things could certainly be improved for the case where you forget to set freezeElevation.
However, note that this is not fully tested - you would have to try out a variety of different easeTo movements, both with freezeElevation set and unset, to make sure there were no regressions. Another potential fix would be not to allow the client to supply freezeElevation, but have I don't really understand this code enough to fully understand why calling both updateElevation and finalizeElevation leads to a drift in the zoom over time. But, here's my high level understanding:
|
PS If anyone wants to rewrite the transform code to make it more like a first-person-shooter - the world has some fixed co-ordinate system, its size never changes, and the camera's position is described (at the lowest level) in terms of its position within this fixed world - I'm all for it, and it would get rid of this class of bugs where the different types of invariants get mixed up. However, I understand this would be a huge breaking change and I am not volunteering. |
There's also the maps' level of details which is zoom defined by the spec, which also complicated everything further. |
FYI I roughly diagnosed this issue but I don't have any strong feelings about what happens next - I could merge the linked PR #3944 if useful |
Let's push the PR forward, thanks! |
Don't _finalizeElevation if freezeElevation has not been set. This means that elevation logic has two distinct operating modes. Mode one - freezeElevation is false - default: - updateElevation is called continuously during the movement - finalizeElevation is *not* called at the end. Mode two - freezeElevation is true: - updateElevation is *not* called continuoulsy during the movement - finalizeElevation is called at the end. Previously, both methods were called in mode one, which lead to issue maplibre#3878 if freezeElevation was not set.
* Fix for #3878 Don't _finalizeElevation if freezeElevation has not been set. This means that elevation logic has two distinct operating modes. Mode one - freezeElevation is false - default: - updateElevation is called continuously during the movement - finalizeElevation is *not* called at the end. Mode two - freezeElevation is true: - updateElevation is *not* called continuoulsy during the movement - finalizeElevation is called at the end. Previously, both methods were called in mode one, which lead to issue #3878 if freezeElevation was not set. * Fix for #3878 - address review comments (done -> async) * Update src/ui/camera.test.ts * Fix for #3878 - address review comments 2 --------- Co-authored-by: Harel M <harel.mazor@gmail.com>
maplibre-gl-js version: 4.1.1
browser: chrome
Steps to Trigger Behavior
See below.
Link to Demonstration
https://jsbin.com/citaminibe/2/edit?html,js,output
Expected Behavior
Like in 2D - no movement
Actual Behavior
Depend on the terrain, this will cause a slow zoom in or zoom out.
The text was updated successfully, but these errors were encountered: