MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / computeShapesBBox

Function computeShapesBBox

src/tools/shape-magic/svgRenderers.js:93–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91 cornerRadii[id] || { tl: globalRadius, tr: globalRadius, br: globalRadius, bl: globalRadius };
92
93export const computeShapesBBox = shapes => {
94 let minX = Infinity,
95 minY = Infinity,
96 maxX = -Infinity,
97 maxY = -Infinity;
98 shapes.forEach(s => {
99 minX = Math.min(minX, s.x);
100 minY = Math.min(minY, s.y);
101 maxX = Math.max(maxX, s.x + s.w);
102 maxY = Math.max(maxY, s.y + s.h);
103 });
104 return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };
105};
106
107// How much extra room the shadow / stroke effects need outside the shape bounds.
108export const effectPadding = style => {

Callers 4

Canvas.jsxFile · 0.90
generateMergedSVGFunction · 0.85
generateCSSClipPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected