xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Bohm" <de...@fireflydesign.com>
Subject Re: grab DOM event?
Date Fri, 05 Sep 2003 16:40:49 GMT
> Denis Bohm wrote:
> > I'm trying to implement dragging using DOM events.  Is there some way to
> > grab events so that I can make sure I get the corresponding mouse
release
> > (even if the release occurs outside the press element)?  Or do I need to
> > resort to Swing/AWT to do that?
>
>     This is ussually done using a 'glass pane' - a rectangle that
> covers the entire canvas and is typically the last element in the
document.
> The rectangle should have 'visibility="hidden"' and initially
> 'pointer-events="none"' - when the user starts dragging you
> change pointer-events to 'fill' - the rect will then capture all
> events.
>
>     You can also leverage the 'capture' phase of DOM events and
> register your event listener on the root node of the document
> using EventTarget.addEventListener, with 'true' for the third
> argument.  This allows you to get all events before anyone else
> normally does.  You can then use stopPropagation to stop others
> from seeing the event (read DOM Events specification for more info).

I tried this approach and it seems to have a couple of problems:
1) When the mouse is moved over text areas the cursor still changes, even
though events are captured and not propagated.
2) No mouse events are dispatched when the mouse is moved over areas in the
canvas that don't have any elements drawn.  The worst case here is that
mouse releases are lost if done in one of these areas.
3) If you press the mouse within the JSVGCanvas, then drag outside the
canvas, then release the mouse - the release is not dispatched.

The last point seems like something that can't be worked around and could
use some handling in JSVGCanvas to pass the release event on - maybe with
the target being the document or root element?  The spec doesn't seem to say
anything about this kind of situation, or does it?


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message