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

Function effectPadding

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

Source from the content-addressed store, hash-verified

106
107// How much extra room the shadow / stroke effects need outside the shape bounds.
108export const effectPadding = style => {
109 let pad = 0;
110 if (style?.shadowEnabled) {
111 pad = Math.max(
112 pad,
113 (style.shadowBlur || 0) + Math.max(Math.abs(style.shadowOffsetX || 0), Math.abs(style.shadowOffsetY || 0))
114 );
115 }
116 if (style?.strokeEnabled) {
117 pad = Math.max(pad, style.strokeWidth || 0);
118 }
119 return Math.ceil(pad);
120};
121
122// Build a renderer-agnostic description of the fill (solid color or gradient).
123// `bbox` must be in the same coordinate space as the drawn paths so a gradient

Callers 1

generateMergedSVGFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected