-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Added a 'wrapAroundWorld' option to the mapboxgl.Map constructor #3885
Added a 'wrapAroundWorld' option to the mapboxgl.Map constructor #3885
Conversation
If `false`, only one copy of the world will be rendered, when zoomed out.
@@ -316,7 +316,8 @@ class SourceCache extends Evented { | |||
minzoom: this._source.minzoom, | |||
maxzoom: this._source.maxzoom, | |||
roundZoom: this._source.roundZoom, | |||
reparseOverscaled: this._source.reparseOverscaled | |||
reparseOverscaled: this._source.reparseOverscaled, | |||
wrapAroundWorld: this.style ? this.style.wrapAroundWorld : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can wrapAroundWorld
be a property on transform
(the update
method parameter), so that Style
doesn't have to be involved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! That's much nicer. I'll update it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jfirebaugh I've updated it -- let me know if this looks good now.
… down through the style
@jfirebaugh Is this good to merge now? |
The implementation looks good. Before merging I want to brainstorm a few other options for naming in hopes that we can find something more precise and self-descriptive than
|
Looks good! I can see two big picture items before we 🚢 this. Todo before merging
|
I think it makes more sense as a global option. I like |
Looks like render tests in mapbox-gl-test-suite are currently setup to just use a style.json, and pass selected data through to the map constructor via style.metadata. To support renderWrappedWorlds (which is a map constructor option), we'd have to add a renderWrappedWorlds option to style.metadata and make suite_implementation.js handle it. Let me know if you're good to go on the name and I can add in a render test. |
I think If you rename to |
@jfirebaugh Ok cool! That makes sense. I've renamed it to renderWorldCopies. |
Hi Guys, With this new render option, is it possible to expose an API to toggle this behaviour opposed to re-instantiating the map? Or is it necessary? I can see some problems where the lnglat of the current camera our out of bounds due to world wrapping. Just looking at adding this function to our react library react-map-gl-alt but a goal of the project is to be able to configure the map through external exposed props - which means that the developer would have the option to toggle. Thanks guys! |
Tried using |
hmm @huaruiwu that sounds like a bug -- do you want to open a fresh ticket to report? |
@mollymerp Sure! #4449 |
If
wrapAroundWorld
is set tofalse
, then only one copy of the world will be rendered, when zoomed out. This solves issue #3785.