svg-path-editor icon indicating copy to clipboard operation
svg-path-editor copied to clipboard

Reset Viewbox

Open justingolden21 opened this issue 3 years ago • 4 comments

The reset viewbox functionality (as seen in download and reset zoom) doesn't work for my path:

m13 0c2 0 11 4 11 20 3 0 4-2 2-8 4 2 10 12 4 20 0 1 2 2 3 0 0 28-40 18-32-6 4-12 14-8 12-26z

image

image

Absolutely love this tool by the way 😄

justingolden21 avatar Feb 14 '22 05:02 justingolden21

Indeed, the default boundary is currently computed using only start and end points. This issue can occur with curves, quadratic curves and elliptical arcs.

Fixing it is a bit tricky, and requires some complicated maths 😅 .

Yqnn avatar Feb 19 '22 17:02 Yqnn

Can you run getBBox()

https://stackoverflow.com/a/40316084/4907950

justingolden21 avatar Feb 25 '22 01:02 justingolden21

A bit of a hack, but indeed it should work. I will give a try.

Yqnn avatar Feb 25 '22 11:02 Yqnn

Another idea: A button to quickly move it so the topmost and leftmost position is at 0,0. Currently, I would just go to export it, note the x and y values, and then translate the x and y negative that much so the export is at a viewbox of x and y at 0,0 and the width and height.

justingolden21 avatar Mar 01 '22 23:03 justingolden21