Compute target rendering size for an SVG
Extracts dimensions from width/height attributes or viewBox, applying pixel ratio. This is a public utility that can be used independently of the overlay operations.
SVG markup string
Target pixel ratio
Fallback dimensions if none found in SVG
Target width and height in pixels
const size = computeTargetSize('<svg width="24" height="24">...</svg>', 2, { width: 32, height: 32 });// => { width: 48, height: 48 } Copy
const size = computeTargetSize('<svg width="24" height="24">...</svg>', 2, { width: 32, height: 32 });// => { width: 48, height: 48 }
Compute target rendering size for an SVG
Extracts dimensions from width/height attributes or viewBox, applying pixel ratio. This is a public utility that can be used independently of the overlay operations.