W3C home > Mailing lists > Public > www-svg@w3.org > June 2002

Re: What does viewBox really do?

From: Dean Jackson <dean@w3.org>
Date: Mon, 24 Jun 2002 14:44:09 +1000
To: rbw@polyglotinc.com
Cc: "J. David Eisenberg" <catcode@catcode.com>, Bruce Wallace <jobs@polyglotinc.com>, www-svg@w3.org
Message-ID: <20020624044409.GA12966@grorg.org>

On Sun, 23 Jun 2002, rbw@polyglotinc.com wrote:

> At 12:35 PM 6/23/2002 -0500, J. David Eisenberg wrote:
> >Now let's look at the first line. Since the viewport width is 4 cm, you
> >would figure that the line would go only one fourth the way across the
> >rectangle, but it doesn't.
> >
> >That's because the viewport has already been established, and, according
> >to the spec, the "1cm" is going to be translated to user units. One
> >centimeter, given my screen resolution, is 37.8 user units. !!But these
> >user units are now presumed to be in terms of the viewBox!!, and 37.8 out
> >of 80 units is about halfway across, which is exactly what you see.
> Is it just me, or does this tortured meaning of cm, inches, etc. depending
> on where one uses them just begging for confusion?  I can't imagine any
> scenario where the above mode of operation is more desired/intuitive than
> simply making 1cm mean the same in both a <line> and an <svg> tag.
> Oh great STD writer gods, what is the rationale behind this interpretation?

The entrails of the sacred lamb dribbled downhill on an overcast night
of full moon and we claimed this to be an omen suggesting we should
confuse all SVG developers from here forward.

The real answer is that is was *very* difficult (as well as processor
intensive) to implement it the other way around (as you would need
to inverse transform up the tree to the root and then back down
again to make sure 1cm is 1cm). So, during Candidate Recommendation
we received strong implementation feedback to have all units
converted into user units on document load. We accepted the
feedback and that's what we have today.

Those SVG developers who have been around for a while may
remember the "userSpace" and "userSpaceOnUse" attributes 
(only "userSpaceOnUse" remains).

The way I think about it is that the viewer converts all units
to user space when the document is loaded, before applying any
transformations. Depending on how you look at this it makes sense, e.g.

<g transform="scale(2)">
  <rect .... width="10cm"/>

Some people want the rectangle to be 10cm wide, others want it
to be 20cm (which is what you get with SVG now). 

The viewBox is just another transform.

Received on Monday, 24 June 2002 00:42:48 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:53 UTC