Skip to content

Commit

Permalink
Add inline snippet to LngLatBounds.contains (#9548)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbranigan authored Apr 20, 2020
1 parent c625efa commit 4ed7ca8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/geo/lng_lat_bounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ class LngLatBounds {
*
* @param {LngLatLike} lnglat geographic point to check against.
* @returns {boolean} True if the point is within the bounding box.
* @example
* var llb = new mapboxgl.LngLatBounds(
* new mapboxgl.LngLat(-73.9876, 40.7661),
* new mapboxgl.LngLat(-73.9397, 40.8002)
* );
*
* var ll = new mapboxgl.LngLat(-73.9567, 40.7789);
*
* llb.contains(ll); // = true
*/
contains(lnglat: LngLatLike) {
const {lng, lat} = LngLat.convert(lnglat);
Expand Down

0 comments on commit 4ed7ca8

Please sign in to comment.