xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: grab DOM event?
Date Mon, 08 Sep 2003 12:12:22 GMT
Denis Bohm wrote:
>>   I think you are being too hard on the transparent rectangle solution.
>>This has a long history in UI engines (lots of X11 apps used this approach
>>to 'deaden' areas of the UI).  Allowing an application to truely grab
>>mouse events can be problematic in a Browser context - easy denial of
>>service attack
> The main problem that I have with the transparent rectangle approach is that
> it doesn't cover the case where the user presses within the JSVGCanvas and
> then drags outside.  The cursor does not remain set - even though the mouse
> is still captured by the JSVGCanvas.  Moves and releases are being processed
> but the cursor does not show the correct feedback.  

   Ok, it turns out this is more complex than I had thought.  During a AWT 'drag'
operation mouse events are always delivered to the element 'under' the cursor.
This is true even when the cursor is outside the window.  You have probably not
noticed this because the default value of 'overflow' on the svg element is
'hidden'.  If you set this to 'visible' and you use the _very_large_ transparent
rectangle approach you will get all of the behaviour you want! ....

   Except! :)
   You need to make sure that as the cursor travels over the stuff around your
canvas none of them set the cursor.  So for example with squiggle if I move 'quickly'
across the left/right/bottom edges I 'keep' the canvas cursor if I move slowly
across the left/right/bottom edges I get the left/right/bottom edge cursor.

   I don't know if this is a problem with squiggle or Java, a few minutes of
searching didn't turn up a reasonable way to overcome this (although I suspect
there is)- any suggestions?

> I tried looking at the
> cursor setting code in Batik to see if I could change the behavior, but it
> seems like it's quite spread out.  Any help would be appreciated.

   The major piece of work is done in 'BridgeContext' by registering DOM over/out
listeners - it then calls setSVGCursor on the brige.UserAgent that ends up calling
the subclass defined in JSVGComponent that calls 'java.awt.Component.setCursor'.

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

View raw message