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

Fixing labels not appearing when enabling terrain at high zoom #3545

Merged
merged 8 commits into from
Jan 9, 2024

Conversation

SnailBones
Copy link
Contributor

@SnailBones SnailBones commented Jan 7, 2024

Fixes #3454

Before:

broken.webm

After:

fixed.webm

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Add an entry to CHANGELOG.md under the ## main section.

@codecov-commenter
Copy link

codecov-commenter commented Jan 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0bb6e69) 85.89% compared to head (2e901eb) 85.90%.
Report is 13 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3545      +/-   ##
==========================================
+ Coverage   85.89%   85.90%   +0.01%     
==========================================
  Files         244      244              
  Lines       48174    48173       -1     
  Branches     5129     5132       +3     
==========================================
+ Hits        41377    41385       +8     
+ Misses       6797     6788       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SnailBones SnailBones marked this pull request as ready for review January 8, 2024 23:32
@HarelM
Copy link
Collaborator

HarelM commented Jan 9, 2024

If I understood the fix correctly, the fix is done by reloading the source cache. Can you clarify why reloading the terrain source cache solves this issue?

@SnailBones
Copy link
Contributor Author

SnailBones commented Jan 9, 2024

If I understood the fix correctly, the fix is done by reloading the source cache. Can you clarify why reloading the terrain source cache solves this issue?

My understanding of this error is that it's caused by the terrain source cache remaining in an incorrect state when terrain is loaded during rendering.

My fix is to first set painter.terrainFacilitator.dirty = true; so that labels will be redrawn, and then reload tiles in the terrain source cache, which triggers another render loop after terrain is correctly loaded.

Just found a much simpler and faster way to fix the issue: calling sourceCache.reload(); on setTerrain, making the fix a one liner.

Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THANKS!

@HarelM HarelM merged commit 2db2f4e into maplibre:main Jan 9, 2024
15 checks passed
@SnailBones
Copy link
Contributor Author

Thank you for the fast review @HarelM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Labels don't appear when enabling terrain at high zooms
3 participants