- From: Dirk Schulze <vbs85@gmx.de>
- Date: Wed, 20 Jan 2010 13:48:02 +0100
- To: Jeff Schiller <codedread@gmail.com>
- Cc: www-svg <www-svg@w3.org>
Hi, I don't know the correct behavior of getBbox, but it sound a bit strange, that the bbox should be the bbox of the rect? The rect isn't placed at 100,100 on applying the <use> coordinates, but why should it still have the old coordinates of the rect position? That would mean, that the bbox is not very helpful on a use element, since it doesn't have any relation to the real position of it or it's content? Greetings, Dirk Am Dienstag, den 19.01.2010, 21:25 -0600 schrieb Jeff Schiller: > Is the following test case correct: > > <svg xmlns="http://www.w3.org/2000/svg" > xmlns:xlink="http://www.w3.org/1999/xlink"> > <rect id="r" x="100" y="100" width="200" height="100" fill="red" /> > <use id="u" x="200" y="200" width="400" height="200" xlink:href="#r"/> > > <script><![CDATA[ > var u = document.getElementById("u"), > r = document.getElementById("r"), > b = u.getBBox(); > if (console && console.log) console.log([b.x,b.y,b.width,b.height]); > if (b.x == 200 && b.y == 200 && b.width == 400 && b.height == 200) ) { > r.setAttribute("fill", "green"); > } > ]]></script> > </svg> > > In other words, shouldn't the bbox of a <use> element be defined by > its x,y,width,height just like a <rect> or an <image> ? No browser > gives consistent results: > > Firefox : 100, 100, 200, 100 > Opera : 100, 100, 200, 100 > WebKit : 300, 300, 200, 100 (huh? clearly a bug!) > > What's ASV do? > What's IE9 do? :) > > Thanks, > Jeff
Received on Wednesday, 20 January 2010 12:48:37 UTC