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

precise location of % scaled symbols

From: Dr. Olaf Hoffmann <Dr.O.Hoffmann@gmx.de>
Date: Sun, 17 Jun 2007 14:27:38 +0200
To: www-svg@w3.org, j.chetwynd@btinternet.com
Message-Id: <200706171427.38419.Dr.O.Hoffmann@gmx.de>

I checked the example with KSVG1, the adobe plugin,
Amaya (9.51), Opera and Iceape 
(a Gecko like Iceweasel, SeaMonkey, Firefox etc), 
but if the viewport in Opera and Iceape is exactly the 
same, size and position of the hovered symbols are the 
same.
If different viewports in one of them are used or the
viewport is resized, the position and size of the
symbols change.

I think, this behaviour is ok, because the example
has no viewBox attribute on the root svg. And because
width and height of this svg is set to 100% and 
preserveAspectRatio is the default 'xMidYMid meet'
for the svg and the symbols, the viewer has to
do some calculations to get the current initial viewport 
to get the precise location and size of the symbols.

How to get the correct position or size for values
noted in percentage is described in the
1.1 specification chapter 7.10.

How the 'used symbol' combination has to be 
replaced by a 'svg in g' combination by the
viewer is described in  the 1.1 specification chapter 5.6.
In a test case I created, the behaviour of Opera and
Iceape seems to fit to 5.6 and 7.10.
Amaya (9.51) unfortunately has several errors in these
examples and does not like to hover. An 
example like this is currently too complex for Amaya.
KSVG1 and the adobe plugin do not like to hover
and have a wrong display for my simpler test case,
(simple) declarative animation and user units
might be better for them as the CSS 
pseudo-class :hover.

To resume: If you want to avoid such problems,
add a viewBox to the root svg. Another thing is,
if there is a viewBox, in most cases there is no
need to use percentage and values in user units 
of the current coordinate system are sufficient.
If you want to report errors to the developers,
it is useful to compare the use+symbol case
with the replaced g+svg case to identify the 
problems in a simple test case.
Received on Sunday, 17 June 2007 12:34:52 GMT

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