in src/atoms/default/stores/camera.js [154:188]
function boundsForAnnotations(annotationsInFocus, annotationFeatures) {
// find map features matching these IDs
let features;
if (annotationsInFocus === 'all') {
features = annotationFeatures
} else {
features = annotationFeatures.filter(d => annotationsInFocus.includes(d.properties.id))
}
if (!features.length) {
throw "No features found"
}
const collection = featureCollection(features);
const convexHull = convex(collection)
// console.log('convex hull', convexHull);
const annotationsCentroid = centroid(convexHull);
// console.log('centroid', annotationsCentroid.geometry.coordinates);
const rotatedHull = transformRotate(convexHull, -40, { pivot: annotationsCentroid.geometry.coordinates })
// console.log('rotated hull', rotatedHull);
const boundingBox = bbox(rotatedHull);
// console.log('bounding box', boundingBox);
const polygonBox = bboxPolygon(boundingBox);
// console.log('bounding box poly', polygonBox);
const rotatedBoundingBox = transformRotate(polygonBox, 40, { pivot: annotationsCentroid.geometry.coordinates })
const coordinates = rotatedBoundingBox.geometry.coordinates[0]
// console.log('rotated bounding box', [coordinates[0], coordinates[2]]);
return [coordinates[0], coordinates[2]]
}