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

Hash is not synced with map position when terrain is enabled. #4125

Closed
HarelM opened this issue May 17, 2024 · 2 comments · Fixed by #4132
Closed

Hash is not synced with map position when terrain is enabled. #4125

HarelM opened this issue May 17, 2024 · 2 comments · Fixed by #4132
Labels
bug Something isn't working PR is more than welcomed Extra attention is needed Terrain 3D

Comments

@HarelM
Copy link
Member

HarelM commented May 17, 2024

maplibre-gl-js version: 4.3.1

browser: Chrome

Steps to Trigger Behavior

  1. npm run start
  2. http://localhost:9966/test/examples/3d-terrain.html
  3. Move the map a bit
  4. Wait 1 second
  5. In the console of the browser execute map.getZoom()
  6. Compare the zoom value to the addressbar hash value - they are different buy just a bit.

Link to Demonstration

image

Expected Behavior

Zoom in the address bar and in the console (current map state) should be the same after the map had stopped moving.

Actual Behavior

The zoom values are different.

@HarelM HarelM added Terrain 3D bug Something isn't working PR is more than welcomed Extra attention is needed labels May 17, 2024
@HarelM
Copy link
Member Author

HarelM commented May 17, 2024

This is related to the fact that we are recalculating the zoom using a moveend event: here:

this._map.once('moveend', () => {
this._map._elevationFreeze = false;
this._terrainMovement = false;
tr.recalculateZoom(map.terrain);
});

This was introduced to solve this issue:

Using this PR:

I think there was another issue related to this code, but I can't find it ATM...

@HarelM
Copy link
Member Author

HarelM commented May 17, 2024

I think the solution is to the _fireEvents method, there's a section at the end with endAnimation, which fires this moveend event, so it might be the right place to add the logic, I'm just not sure what it will break...

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
Development

Successfully merging a pull request may close this issue.

1 participant