When I export to svg, I usually want the file to have the same dimensions as the content, without any empty space around it. Right now this is only possible by manually editing the .svg output and adding a viewBox attribute, which requires calculating the minimal x and y values as well as the width and height of the content while taking into account the line thickness. The whole process can be quite time-consuming and error-prone for larger files.
The PR automatically calculates and saves the viewBox and tries to make sure that the resulting svg fits into these bounds. In the case of round or beveled line joins this is quite easy, but in the case of miter line joins (which could theoretically overshoot the angle point by quite a large amount in the case of sharp angles) an offset equivalent to the line thickness is used (which should give an acceptable result in most cases).
When I export to svg, I usually want the file to have the same dimensions as the content, without any empty space around it. Right now this is only possible by manually editing the
.svg
output and adding aviewBox
attribute, which requires calculating the minimal x and y values as well as the width and height of the content while taking into account the line thickness. The whole process can be quite time-consuming and error-prone for larger files.The PR automatically calculates and saves the
viewBox
and tries to make sure that the resulting svg fits into these bounds. In the case of round or beveled line joins this is quite easy, but in the case ofmiter
line joins (which could theoretically overshoot the angle point by quite a large amount in the case of sharp angles) an offset equivalent to the line thickness is used (which should give an acceptable result in most cases).