W3C home > Mailing lists > Public > www-svg@w3.org > October 2003

Re: preserveAspectRatio / viewBox

From: Dean Jackson <dean@w3.org>
Date: Tue, 7 Oct 2003 01:25:35 +1000
To: "Shutter, Simon B WLAP:EX" <Simon.Shutter@gems4.gov.bc.ca>
Cc: "'www-svg@w3.org'" <www-svg@w3.org>
Message-ID: <20031006152535.GH6869@grorg.org>

Simon,

On Tue 23 Sep 2003, Shutter, Simon B WLAP:EX wrote:

> I am struggling to understand the concepts of coordinate transformations and
> nested objects.  What I would like to do is create a viewbox that has an
> aspect ratio that is different to the svg width and height but I don't want
> to preserve the aspect ratio.  Inside that viewbox I would like to create
> another element but preserve it aspect ratio.

Well, you can certainly preserve the aspect ratio of 
anything anywhere, but only relative to its parent coordinate
system. In other words, once you've screwed up the ratio,
everything underneath inherits the mess. Unfortunately the
inner element can't tell that its parent has an un-preserved
aspect ration. Does this make sense?

> I'm hoping someone can suggest a best practice for this.

Unless I'm having a bad day and forgetting something, I don't
think there is an easy way. Through scripting you could work
out what the transformations are at any stage down the tree and
then set a viewBox that would work, but that would be a little
tricky.

Dean
Received on Monday, 6 October 2003 11:25:38 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:25 GMT