On Jan 17, 2008 9:33 AM, Redefined Horizons <[EMAIL PROTECTED]> wrote:
> Is the ability to work with user selections of shapes built into the > JSVGCanvas, or is it something I will need to add? (It looks like I > will need to add it, but I thought I would check here before I wrote > something from scratch.) > That's something you will have to add. Batik has no notion of a "current selection". Is there an existing method that will allow me to obtain all the > shapes on a JSVGCanvas that are within a specified radius of a mouse > click? What about obtianing all the shape elements in a DOM of an SVG > document that are withing a specified radius of a coordinate in the > SVG coordinate system? It's easy to find the bounding box of any graphical element, using code like this: SVGRect bbox = ((SVGLocatable)node).getBBox(); This will be in local coordinates however, so you may want to convert that to global coordinates. The matrix to do this is gotten like this: ((SVGLocatable)node).getTransformToElement(topNode)); where topNode is the top <svg> node. So if the bounding box is a good enough approximation to "where a shape is" then you can use it to determine distance from mouse clicks, etc.. -Archie -- Archie L. Cobbs
