| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1× 454× 1× | /**
* Returns a bounding box representing the event's location.
*
* @param {Event} mapEvent - Mapbox GL JS map event, with a point properties.
* @return {Array<Array<number>>} Bounding box.
*/
function mapEventToBoundingBox(mapEvent, buffer = 0) {
return [
[mapEvent.point.x - buffer, mapEvent.point.y - buffer],
[mapEvent.point.x + buffer, mapEvent.point.y + buffer]
];
}
module.exports = mapEventToBoundingBox;
|