Bishop, Michael W. CONTR J9C880 wrote:

No, it's not a typo.  I must not have been clear.  I'm talking about the
two parameters to getIntersectionList().  One is an SVGRect, which I
assume is the box I want to check.  The other is an SVGElement called
"referenceElement".  I don't know what that one represents.

Sorry, missed that one. In that case, better wait for Tonny's or Thomas's explanation.

OK, this is a bit of confusion in a related topic.  Currently my
"Select" tool works for a single element; you click it and it becomes
selected.  When I call getBBox() on it, the bounding box does not take
into account any scaling or rotating on the selected element.  So if I
have selected a "rect" element that's rotated 45 degrees and scaled
200%, the bounding box still reflects the original element.  You're
saying I can solve this by calling getCTM() on the element?  I've been
manually applying the scale factor, but rotate had me scratching my
head.

I've not yet worked with rotations, but I the CTM should solve your problems. Depending on your code (that is, if you have several transformed groups or elements nested into each other), you might need to use the ScreenCTM instead.

It's documented here in chapter 7 of the W3C specification, subsection 7.4. There's an example given for each kind of transformation, complete with the resulting matrix, so you should find your way around.
Note that the matrices given have their coordinates aligned as
(a c e)
(b d f)
(0 0 1)
This caused a bit of confusion on my first encounter, since I expected abc to be in the top row.

GetCTM gives you the matrix that's applied to transform the element. Basically, it's a matrix similar to the one you give as an argument to the "transform="matrix(...)"" attribute for most elements. All the values are in there, though you might have to look twice to find them.

If you're still having trouble, I could send you the java class our project uses to transform bounding boxes from the SVG userspace to the screen userspace as an example.

Here's the link to the w3c:
http://www.w3.org/TR/SVG/coords.html

Good Luck
-Urs


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to