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

Fix for #3935 - pan-jump when map is large #3940

Merged
merged 2 commits into from
Apr 5, 2024
Merged

Conversation

olsen232
Copy link
Contributor

@olsen232 olsen232 commented Apr 4, 2024

When the map canvas is large - >2048px, probably* - the coords canvas stops growing with the map due to web GL limitations. This means that a screen-pixel is no longer 1:1 with a coords-canvas pixel. It needs to be scaled using the ratio of devicePixelRatio and painter.pixelRatio, which are no longer equal when the map is large.

*This might depend on your machine and its willingness to create webgl textures larger than 2048 x 2048.

Fixes #3935

Before / After

before.mp4
after.mp4

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.
  • Document any changes to public APIs. (N/A)
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

When the map canvas is large - >2048px, probably - the coords canvas
stops growing with the map due to web GL limitations.
This means that a screen-pixel is no longer 1:1 with a coords-canvas
pixel. It needs to be scaled using the ratio of devicePixelRatio and
painter.pixelRatio, which are no longer equal when the map is large.
@codecov-commenter
Copy link

codecov-commenter commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.74%. Comparing base (a5934cb) to head (95667c1).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3940      +/-   ##
==========================================
- Coverage   86.83%   86.74%   -0.10%     
==========================================
  Files         242      242              
  Lines       32479    32482       +3     
  Branches     1977     1993      +16     
==========================================
- Hits        28204    28177      -27     
- Misses       3341     3367      +26     
- Partials      934      938       +4     

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

@HarelM
Copy link
Collaborator

HarelM commented Apr 4, 2024

Looks good! Thanks!
Please add a test and a changelog entry.

@olsen232
Copy link
Contributor Author

olsen232 commented Apr 4, 2024

Done

@HarelM HarelM merged commit c38d4d7 into maplibre:main Apr 5, 2024
15 checks passed
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.

Large screen: unwanted pan-jump as pan action finishes (3d terrain)
3 participants