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).



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



Reply via email to