Conversation
These work with anti-meridian unlike turf.js.
|
Also I wasn't sure how to handle if the user provides center or zoom. Right now it will simply not do box fitting if either of those params are provided. |
|
Hi @palmerusaf ! Sincere apologies for my delay in getting back to you. I think this approach makes sense at a high level. My only concern is the performance; could you do a basic benchmark of the time to compute If there's a noticeable performance impact, maybe we could still pursue this approach but provide a way to disable auto-fitting of bounds. Or maybe the fact that it can be skipped by manually setting I'll leave a few other small comments on the code. The implementation isn't expected to be working quite yet, correct? |
| var { minLat, maxLat } = getMinBoundLat(lat); | ||
| // this param is called bounds in mapLibre ctor | ||
| // not to be confused with maxBounds aliased below | ||
| containerOut.fitBounds = { |
There was a problem hiding this comment.
Prefix this property with an underscore since it's an internal property, not part of the plot schema.
| containerOut.fitBounds = { | |
| containerOut._fitBounds = { |
| containerOut._input = containerIn; | ||
| } | ||
|
|
||
| function getMinBoundLon(lon) { |
There was a problem hiding this comment.
| function getMinBoundLon(lon) { | |
| function getLonBounds(lon) { |
| } | ||
| } | ||
|
|
||
| function getMinBoundLat(lat) { |
There was a problem hiding this comment.
| function getMinBoundLat(lat) { | |
| function getLatBounds(lat) { |
| pitch: opts.pitch, | ||
| bounds: fitBounds, | ||
| fitBoundsOptions: { | ||
| padding: 20, |
There was a problem hiding this comment.
Since this padding is used twice, define it as a constant in map/constants.js.
Will these fitBoundsOptions have any effect if bounds is null?
This is for issue #7674. This uses a custom algo to get the bounds, then uses mapLibre to set the zoom/center via fitBounds. Turf.js doesn't handle the anti-meridian correctly. If you'd like I can add the helper functions to geo location utils to knock out a TODO there. I just need to refactor the signatures.