diff --git a/lib/src/geo/latlng_bounds.dart b/lib/src/geo/latlng_bounds.dart index 62724972f..8534a9018 100644 --- a/lib/src/geo/latlng_bounds.dart +++ b/lib/src/geo/latlng_bounds.dart @@ -146,6 +146,15 @@ class LatLngBounds { west = max(minLongitude, min(west, bounds.west)); } + /// Expands bounding box by [latitude] and [longitude]. This method mutates + /// the bounds object on which it is called. + void pad(double latitude, double longitude) { + north = min(maxLatitude, north + latitude); + south = max(minLatitude, south - latitude); + east = min(maxLongitude, east + longitude); + west = max(minLongitude, west - longitude); + } + /// Obtain coordinates of southwest corner of the bounds. /// /// Instead of using latitude or longitude of the corner, use [south] or