RE: getBoundingClientRect
"Christian Linder" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.svg |
|---|---|
| Message-ID | <[email protected]> |
Hi,
more specifically, I try to use getBoundingClientRect on a text element
because I need to rotate that text by 90 degress and therefore I need
the center of rotation.
If I multiply the values by 3600 in FF 3.05, I get the desired behavior:
the text is rotated by 90 degrees around its center. If I try the same
with or without multiplying in FF 3.1beta2, it doesn't work. I changed
the sample page at
http://go2ghana.net/devel/svg/devel.xhtml
and included a text element, the last three lines read now (for some
reason, I cannot subscribe for "click" on a text node):
<rect x="10" y="150" width="200" height="100"
onclick="dumpLayout(document.getElementById('test'))" fill="#000064"
stroke="red" stroke-width="1" />
<text id="test" x="100" y="400">Hello</text>
</svg></body></html>
Clicking on the rectangle at the bottom now dumps the layout of the text
element. This way, you can see the difference between FF 3.05 and 3.1:
Firefox 3.05:
left:0.01666259765625
top:102.10000610351562
right:0.0500030517578125
bottom:102.11666870117188
which in itself I don't understand, because in my actual code ALL the
values are below one and need to be multiplied by 3600, not just left
and right.
Firefox 3.1beta2 gives me:
top:-858
right:2048
bottom:358
left:0
width:2048
height:1216
which, as you can see, is probably the bounding box of my whole browser
window, not the text element.
Any comments on that are welcome, including an easier way to rotate my
text ;-)
Best regards
Christian
From: Axel Huizinga [mailto:[email protected]]
Sent: Donnerstag, 29. Januar 2009 15:03
To: Christian Linder
Subject: Re: getBoundingClientRect
Hi Christian,
as one can see while clicking on the rectangles
on the sample http://go2ghana.net/devel/svg/devel.xhtml
firefox 3.1 does report the boundingClientRect now as expected
- no more need to multiply.
Axel
Christian Linder schrieb:
Hi everybody,
I found this thread in the history, and I couldn't see any change in
behavior in the FF3.1beta2
Does anybody happen to know whether that will be in 3.1 or whether I
will still have to multiply by 3600?
Best regards
Christian
On Oct 17, 4:19 pm, Axel Huizinga <a...
<http://groups.google.com/groups/unlock?_done=/group/mozilla.dev.tech.sv
g/browse_thread/thread/db7b90a314164fe0&msg=b902a39d6c66b065>
@go2ghana.de> wrote:
Hi,
trying to get the bounds of an SVGElement with getBoundingClientRect
makes me some trouble.
See yourself athttp://go2ghana.net/devel/svg/devel.xhtml
<http://go2ghana.net/devel/svg/devel.xhtml>
on the top is a div which reports as expected
below are two svg rect which report very small values of width and
height which
don't make sense to me yet.
Any ideas how to translate them topixel units?
Best,
Axel
I answered this in the newsgroup. If you want to translate them in
firefox 3.0, multiply them by 3600 but be careful because firefox 3.1
will produce the correct numbers.
Best regards
Robert
_______________________________________________
dev-tech-svg mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-svg