By default, preserverAspectRatio scales the viewport from the center because the default ist xMidYMid. The current implementation works differently somehow.
Try the following snippet (excerpt of a mermaid SVG) that applies a viewbox scaling.
The resulting sketch is scaled non-uniformly and when an additional translation is added to the above viewBox, things even get worse.
I think we should at least support the default correctly (scaling uniformly from the center), but also support preverAspectRatio="none" with is almost what we have already. IIRC, the current implementation is just a workaround until the given test-cases worked, so this may be the culprit to begin with.
By default, preserverAspectRatio scales the viewport from the center because the default ist
xMidYMid
. The current implementation works differently somehow.Try the following snippet (excerpt of a mermaid SVG) that applies a viewbox scaling.
The resulting sketch is scaled non-uniformly and when an additional translation is added to the above viewBox, things even get worse.
I think we should at least support the default correctly (scaling uniformly from the center), but also support preverAspectRatio="none" with is almost what we have already. IIRC, the current implementation is just a workaround until the given test-cases worked, so this may be the culprit to begin with.