I've looked through the archives for a while now and although it helped me
solve parts of my problem I did not find an answer for my exact case so I'll
try lay it out here hoping somebody can help me...
For now: I'm using a JSVGCanvas to show and interact with a SVG-Document.
What I'm trying to do:
If the the mouse is clicked into the canvas I want to handle two basic
If the click hits an instance of a "special Element" I want to select this
Element, else I want to add such a "special Element" in the document.
What I already can do:
I can detect clicks into the JSVGCanvas with a MouseListener on the canvas
and I can detect which SVGElement of the Document is hit whith a
MouseListener on the SVGRoot-Element...
With the two things I know I can detect when a Mouse clicked into the Canvas
and when it hits any SVGElement - this would suffice if I could combine both
somehow, but for now I don't see how...
If I could trigger the "hit-check" from inside the Canvas-MouseListener or
if i could do this check before I get into the MouseListener, so that I
know, if an object was clicked before the canvas tells me that there was a
I could try to work around this by inserting a detectable background in the
SVG but I don't really like this approach...
1 - is there a way, to trigger the SVGElement's MouseListener during or
before the Canvas MouseListener?
2 - if not, does somebody see a way to work around this without ceating a
"detectable background" in the SVG?
I really hope someone can give me a hint or a pointer - any help is