<g onMouseClick="doEvent(evt)" >
<rect id="object 1" ...../>
<rect id="object 2" ...../>
<rect id="object 3" ...../>
<rect id="object 4" ...../>
</g>
the event will be activated and dispatched only when the click is inside any of the rect objects, and the evt.target will tell you what is the clicked object.
You may also see the dragTutorial in the batik wiki to see how to add listeners in the code:
http://wiki.apache.org/xmlgraphics-batik/DragTutorial
regards,
Andres.
p.s. the same is true for all other mouse events.
On Oct 24, 2005, at 1:04 PM, Bishop, Michael W. CONTR J9C880 wrote:
<x-tad-bigger>I have a scenario where I’d like to click in the JSVGCanvas and “select” the SVG element I’m clicking inside of. Short of iterating through the document and creating Java2D objects in which to check to see if my clicked point is “inside” of, is there a way in Batik to see which elements a point resides in?</x-tad-bigger>
<x-tad-bigger> </x-tad-bigger>
<x-tad-bigger>Michael Bishop</x-tad-bigger>
