svg-path-bounds

Get boundary box of svg path data

Stars
64
Committers
2

svg-path-bounds test

Retrieve bounding box from svg path data.

const getBounds = require('svg-path-bounds')

let [left, top, right, bottom] = getBounds('M0 0L10 10 20 0Z') // [0, 0, 20, 10]

bounds = getBounds(path|segments)

Calculate bounding box for svg path data string or parsed path segments array. The box is detected by controlling points, not the real path.

Related

Similar

License

MIT © Dmitry Iv.