-
-
Notifications
You must be signed in to change notification settings - Fork 717
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
[Feature] Allow underzooming with single-copy world #4612
[Feature] Allow underzooming with single-copy world #4612
Conversation
…tates the zoom-out limit
Update with latest main
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4612 +/- ##
===========================================
- Coverage 87.94% 65.51% -22.44%
===========================================
Files 247 247
Lines 33616 33620 +4
Branches 2375 1405 -970
===========================================
- Hits 29564 22025 -7539
- Misses 3087 10775 +7688
+ Partials 965 820 -145 ☔ View full report in Codecov by Sentry. |
I need help with these (@HarelM or others?):
|
Yes, this is a breaking change according to current implementation. unit tests are needed to make sure this the functionally is captured, similar to the unit tests that failed as part if this changes. |
Thanks for the tips. I agree that giving users control over this would be useful. Using minzoom does seem easier at first glance but then the relative visible out-of-bounds area becomes dependent on viewport size where the map would always be (for example) 256px wide regardless of screen size. The design I propose maintains a standard ratio of visible out-of-bounds areas that keeps a standard balance of map area to underzoomed viewport area. This ensures a fully zoomed out small and tall viewport (like a phone) appears the same on a large and wide viewport (like a monitor). This ratio is currently 50%: I'll give it some thought for further options or other approaches and update here. |
The 0.5 ratio is probably what you need, but it might not be what other people need... :-) |
Indeed 👍 I'll look to add that as a setting and put a demo here showing what happens when it is adjusted. (Also, let me know if it's better that I hold this discussion back in #4510 instead of in this PR — I'm not aware of best practices for where it's best to hold them.) |
Since there are others subsrived to the issue itself I think it will be better to continue the discussion there. |
Closing this draft PR as I'm taking a different design approach. Will discuss further in #4510. |
Launch Checklist
Fixes #4510, #4591 by allowing the map to be underzoomed when
renderWorldCopies=false
:Here is a demo where you can toggle
renderWorldCopies
:https://larsmaxfield.github.io/swings/maplibre-underzoom/render-world-copies.html
The solution is a simple change to
getConstrained()
insrc/geo/transform.ts
where whenrenderWorldCopies=false
the viewport (screen) is assumed to be a square with side length equal to the smallest screen dimension reduced by aboundsRatio
factor of 50%. This allows the map to be panned and zoomed out 50% beyond the bounds along the narrowest screen dimension.This change does not override
minZoom
— it always obeys that value.Since users can pan and zoom 50% beyond the bounds, it means that a map with a specified
maxBounds
(andrenderWorldCopies=false
) will allow users to pan and zoom beyond those bounds. Here are two demos of that:https://larsmaxfield.github.io/swings/maplibre-underzoom/tall-bounds.html
https://larsmaxfield.github.io/swings/maplibre-underzoom/wide-bounds.html
Fixes #4510, #4591
CHANGELOG.md
under the## main
section.