W3C home > Mailing lists > Public > public-fx@w3.org > October to December 2013

[css-transforms] transform-origin and SVG elements

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 17 Oct 2013 10:34:31 +1100
Message-ID: <525F2287.8050002@mcc.id.au>
To: "public-fx@w3.org" <public-fx@w3.org>
I think the behaviour of transform-origin, where lengths mean different 
things depending on whether the element is an SVG element or not, isn't 
great.  It leads to questions like:

- Why shouldn't 'transform-origin: 0px 0px' and 'transform-origin: 0% 
0%' mean the same thing?  Surely 0% of anything is 0, and so that should 
be equivalent to 0px.

- How do we treat 'transform-origin: calc(0% + 0px) calc(0% + 0px)'?


What about having something in the property value that explicitly opts 
in to having values be relative to the SVG viewport rather than the 
bounding box?  For example:

   transform-origin: viewport 50% 50%;  /* middle of the viewport */
   transform-origin: 50% 50%;           /* middle of the bbox */
   transform-origin: viewport 4px 4px;  /* relative to viewport origin */
   transform-origin: 4px 4px;           /* relative to the bbox origin */

And then the UA style sheet could set

   transform-origin: viewport 0 0;

on SVG elements.


Alternatively, since setting the transform origin to be anything 
viewport relative except for the origin isn't that useful -- and could 
be handled by translations in the 'transform' property -- we could just 
add a single new value which means the viewport origin for SVG elements, 
and the bbox origin for other elements:

   transform-origin: auto;

This would then be the initial value, no need for a UA style sheet rule. 
  Percentages and lengths would always be relative to the bbox.


Even if we don't do either of these, and leave the "percentages are 
interpreted differently" behaviour, we should define what happens with 
calc()s that contain percentages.
Received on Wednesday, 16 October 2013 23:35:07 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:49:47 UTC