Hi aKIv,
aKIv <[email protected]> wrote on 07/16/2010 05:32:28 AM:
> I have got a problem in case of using the method getBBox. For Example my
SVG
> Document have got two circle elements. Now i am trying to get the
element
> from the canvas on click. The problem here is, that i only can click on
the
> lastChild of my circle element. Also the program is now assigning all
circle
> elements.
I'm fairly certain that this is a problem with coordinate systems.
e.getPoint is the click location in a screen coordinate system.
svgElement.getBBox() is the bounding box in the local coordinate system
of 'svgElement'. In your document I'm guessing that for the 'last child'
the screen and local coordinate system happen to be the same, and since
you aren't accounting for the transform on your other circle elements they
all thing they were clicked when the last child is clicked.
What you need to do is transform the event point by the inverse of
the getScreenCTM affine transform you get from each of your circle
elements.