Howdy,

If I'm understanding you correctly, you'd want:

        Element elem = ....;    // DOM Element
        EventTarget target = (EventTarget) elem;  // works with almost all SVGElements
        target.addEventListener(new EventListener() {
                ...
        });

The relevant event classes are in org.w3c.dom.events.


Good luck.

- Bibek

PS: there's already a SVG Editor available as part of the LessonBuilder
project on SF.  If you give me a few hours, I'll even upload my "cleaned-up"
code where the SVG Editor is a separate CVS module... ;-)


On Wed, Mar 31, 2004 at 11:02:26AM +0200, George Armhold wrote:
> Hi,
> 
> I'm working on what is essentially a whiteboard-like drawing app.  I'm
> using a JSVGComponent, adding elements to the DOM in response to mouse
> clicks.  I also have a SVGUserAgentAdapter extension that launches a
> web browser when <svg:a/> links are clicked.  Both link-clicking and
> drawing are left-mouse button events.  The problem is that when my
> drawing code is enabled, the SVGUserAgentAdapter never seems to get
> the mouse clicks.  Finally I realized that what's probably happening
> is that my drawing code is adding elements (lines) to the document, so
> when the canvas sees the mouse events, the <svg:a/> is no longer on
> top; my <line/> elements are.  If I change my drawing code to add
> lines of width 0, the SVGUserAgentAdapter sees the events.
> 
> One solution would be to do the link handling myself, if I can
> determine when a MouseEvent occurs over a <svg:a/> element.  So I
> first check to see if there's a link under the mouse, and if not, do
> my drawing as usual.  So my question is the following: how can I
> associate a DOM element with a given MouseEvent?  Or is there a better
> way to attack this?
> 
> Thanks.
> 
> -- 
> George Armhold
> Rutgers University
> eLearning Grant, DCIS
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to