Re: viewport units in SVG

Hello Dirk,

Tuesday, July 22, 2014, 9:29:54 PM, you wrote:

> Hi,

> CSS and SVG have both the notation of a “viewport”. However, both
> mean different things.

> 1) For CSS it is basically the area of a webpage that is visible in
> a window.

and in particular, there is only one CSS viewport.

> 2) For SVG (simplified) it is the dimension of the canvas. Certain
> elements can create a new viewport in which case the size of the
> element is the size and origin of the viewport.

so there can be multiple SVG viewports. (SVG uses the normal computer
graphics definition of a viewport, an axis aligned rectangle in
coordinate space A into which a portion of coordinate space B is
mapped. Thus these can be nested, there can be multiple of them, and
at some point coordinate space A is some physical units on an output
device and coordinate space B is the world coordinate system at the
top level of the graphic).

> CSS introduced viewport units vh, vw, vmin and vmax. Of course they
> represent the visible area in the window: 1vw is basically the
> horizontal area of the window.



> What do we do with viewport units in SVG? I would assume that they
> mean the same for SVG roots as for CSS in HTML.

Meaning they are window-derived coordinates that have nothing to to
with the (SVG) viewport? Yes.

> Independent of the canvas size the viewport units represent the
> width and height of the window. With overflow: scroll, it should
> already be useful. But what about SVG viewport generating elements
> and the content in them? The window size might not matter inside.
> Authors could also find the canvas size useful as a reference point.
> For the latter we would still have percentage though.

CSS has a concept X. SVG has a concept Y with the same name. CSS has
units that operate on X. It seems that here, you are arguing those
units should operate on Y in SVG.

Rather, it seems that those units should operate on X, like they were
designed to. In other words, whether SVG has made new SVG:viewports
on a particular element should not affect how operations on
CSS:viewports behave.

If someone has specified vh etc then they are operating at the top
level CSS viewport (window) level irrespective of any (CSS:)transforms
that are applied. So the same should be expected for SVG.

I understand that it has to be specified so the code does something
for all possible combinations of inputs, but in actual usage I would
expect friends on SVG content to mainly apply it to a rootmost svg
element.


-- 
Best regards,
 Chris                            mailto:chris@w3.org

Received on Wednesday, 23 July 2014 12:44:10 UTC