Add LatLngBounds.contains() method #7512
Labels
api 📝
GL native → GL JS
For feature parity with Mapbox Maps SDK on a native platform
good first issue
Motivation
I'm splitting this request out from #7090 in which several different
LatLng
andLatLngBounds
methods were brought up. GL Native has aLatLngBounds.contains
utility method which is missing in JS. Adding this method to JS would increase parity between GL implementations and provide a useful method to users.Design
I can see two possibilities.
I'd say the instance method is preferable since all other methods on
LatLngBounds
are also instance methods. The static method would mostly be useful as a pure utility method in which you may want to check arbitrary bounds for a point, but does that have many use cases? I'm unsure.contains
should be able to check that a bounding box contains a point or a CanonicalTileID, as the Native implementation does. Native also checks unwrapped bounds, but that concept isn't well defined in JS and I think we can side step that implementation for now.Implementation
We should be able to just port the C++ implementation
https://github.com/mapbox/mapbox-gl-native/blob/master/src/mbgl/util/tile_range.hpp#L40
The text was updated successfully, but these errors were encountered: