| 106 | |
| 107 | // How much extra room the shadow / stroke effects need outside the shape bounds. |
| 108 | export 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 |