From 4ed7ca898b71f2384fe0c79ac1aa7267cea6cdb3 Mon Sep 17 00:00:00 2001 From: jbranigan Date: Mon, 20 Apr 2020 16:46:29 -0500 Subject: [PATCH] Add inline snippet to LngLatBounds.contains (#9548) --- src/geo/lng_lat_bounds.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/geo/lng_lat_bounds.js b/src/geo/lng_lat_bounds.js index 7fbf4db9c4a..6bc992340ef 100644 --- a/src/geo/lng_lat_bounds.js +++ b/src/geo/lng_lat_bounds.js @@ -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);