Re: [csswg-drafts] [css-transforms-1] 'view-box' definition doesn't make sense (#4662)

The definition may sometimes create unintuitive results, but this is how transforms and percentages have always been defined in SVG. Transforms are relative to the 0,0 origin, regardless of where that is in the graphic (or even if it is way outside the graphic). And percentage width/height are always relative to the full viewBox width/height, regardless of how that is offset from the origin.

And the basic behavior is definitely useful, if you're used to working with SVG viewBox intentionally (e.g., to create a centered coordinate system) and sizing SVG elements in percentages relative to that origin. (I don't have any examples doing this, but mostly because the support hasn't existed to really make it worth playing around with `transform-origin` for SVG.)

In your case of fudging the viewBox width/height to create padding, the results are less useful, but I'm not sure what would be more useful? In your example of `viewBox="-20 -20 140 140"`, you probably want 100% = 100 units, but I'm not sure how the browser is supposed to guess that. Best to avoid setting your transform origin in percentages at all in that case.


-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4662#issuecomment-576496516 using your GitHub account

Received on Tuesday, 21 January 2020 02:55:08 UTC