-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from Vizzuality/SKY30-476-fe-zoom-to-the-corr…
…ect-bounds-when-selecting-a-location Zoom to the correct bounds depending on the environment
- Loading branch information
Showing
6 changed files
with
72 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { BBox } from '@turf/helpers'; | ||
|
||
/** | ||
* Combines two bounding boxes into a single bounding box that encompasses both | ||
* @param bbox1 First bounding box [minLon, minLat, maxLon, maxLat] | ||
* @param bbox2 Second bounding box [minLon, minLat, maxLon, maxLat] | ||
* @returns Combined bounding box | ||
*/ | ||
export const combineBoundingBoxes = (bbox1: BBox, bbox2: BBox): BBox => { | ||
return [ | ||
Math.min(bbox1[0], bbox2[0]), | ||
Math.min(bbox1[1], bbox2[1]), | ||
Math.max(bbox1[2], bbox2[2]), | ||
Math.max(bbox1[3], bbox2[3]), | ||
]; | ||
}; |