Re: [svg2] transform on <svg>

Amelia Bellamy-Royds:

>On 8 December 2014 at 11:44, Robert Longson <longsonr@gmail.com> wrote:
>
>> I did not mean using fragment identifiers to set a view, I mean something
>> like #svgView(transform(scale(2)))
>>
>>
>Apologies, I was forgetting that option.
>
>The SVG 1.1 specs don't have any implementation details about what is
>*supposed* to happen.  

See:
http://www.w3.org/TR/2003/REC-SVG11-20030114/linking.html#SVGFragmentIdentifiers

Especially:
'in the case of transform(...), the same meaning as the corresponding 
attribute has on a 'g' element).'

If we have for example:
<svg width="6cm" height="4cm" viewBox="-3 -2 6 4" version="1.1"
     xmlns="http://www.w3.org/2000/svg">
  <title>Transform example</title>
  <circle r="3" />
</svg>

#svgView(transform(rotate(20)))
corresponds clearly to:
<svg width="6cm" height="4cm" viewBox="-3 -2 6 4" version="1.1"
     xmlns="http://www.w3.org/2000/svg">
  <title>Transform example</title>
  <g transform="rotate(20)">
    <rect x="-2" y="-1" width="4" height="2" />
  </g>
</svg>
(there is no meaningful other way to add a g element with the intended
effect).

This ensures:
'This form of addressing specifies the desired view of the document (e.g., the 
region of the document to view, the initial zoom level) completely within the 
SVG fragment specification.'

If we assume, that a transform applied to the root svg element should have
the same effect than such an SVG fragment identifier, clearly CSS has nothing
to to with this.
Neither the viewBox is rotated nor the viewport.
If one needs tho modify the viewBox, the SVG fragment identifier definition
has an additional parameter for this.
Following the recommendations, such parameters replace or represent
corresponding attributes of a view element, which replace corresponding
attributes of the element the view applies to.
(See as well SVG tiny 1.2 for something without a view element resulting
in the same effect.)

If one needs to rotate or skew the entire SVG graphic within another (X)HTML
document, it might be helpful to put the SVG into an (X)HTML element and to
apply some CSS transformation to this element once the CSS transform draft
becomes a recommendation. To do this, it is the task of the format of the
embedding document respectively of a stylesheet, no task for the SVG
document or fragment itself.
In typical graphical environments viewports or windows cannot be rotated 
or skewed, therefore for standalone SVG documents displayed in windows on
monitors or with printers, it is not meaningful to rotate or skew the viewport 
or window.
Therefore one can clearly assume that width, height and viewBox are 
always aligned to, what is considered parallel to width and height 
direction of a monitor or sheet of paper.
The CSS draft about transform may take into account such restrictions
for root elements as well, if they do not already.


Olaf

Received on Tuesday, 9 December 2014 11:44:12 UTC