Hi Michael,

"Bishop, Michael W. CONTR J9C880" <[EMAIL PROTECTED]> wrote on 
10/24/2005 01:46:18 PM:

> Just to be clear, I?m doing this in Java, not the SVG-supported 
JavaScript. 
> Nonetheless, this drag tutorial seems to be precisely what I?m looking 
for. 
> Does it require JavaScript (or anything else extra) to be present in the 
document?

   All of the dynamic stuff is fully available in Java as well as in 
JavaScript
(EcmaScript).  If you don't have any obvious dynamic elements in your 
document
then you need to inform Batik to treat your document as dynamic, using
JSVGComponent.setDocumentState(ALWAYS_DYNAMIC).

   You will have to add your listeners using the DOM interfaces
(addEventListener) instead of using the event attributes
(on click etc).

> From: Andres Toussaint [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 24, 2005 1:19 PM
> To: [email protected]
> Subject: Re: Efficient way of "selecting" an element?
> 
> SVG has the ability to dispatch events based on mouse actions, and the 
event 
> holds the object that triggered the event (which is not necessarily the 
object
> holding the listener, in case it is a group), for example: 
> 
> <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: 
> 
> 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? 
> 
> Michael Bishop 

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

Reply via email to