@create-figma-plugin/utilities
Version:
An extensive library of utility functions for common Figma/FigJam plugin/widget operations
28 lines • 823 B
JavaScript
import { computeBoundingBox } from './compute-bounding-box.js';
export function computeMaximumBounds(nodes) {
let maximumBounds = [
{
x: Number.MAX_VALUE,
y: Number.MAX_VALUE
},
{
x: -1 * Number.MAX_VALUE,
y: -1 * Number.MAX_VALUE
}
];
for (const node of nodes) {
const { x, y, width, height } = computeBoundingBox(node);
maximumBounds = [
{
x: Math.min(maximumBounds[0].x, x),
y: Math.min(maximumBounds[0].y, y)
},
{
x: Math.max(maximumBounds[1].x, x + width),
y: Math.max(maximumBounds[1].y, y + height)
}
];
}
return maximumBounds;
}
//# sourceMappingURL=compute-maximum-bounds.js.map