Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef-dev] Draw2d Mouse Events Mechanism

Hi all,

I am Working a lot with Draw2d, and finally got a Draw2d figure hierarchy quit complex. In fact, the important thing is just that i have a "transparent figure" on top of several others. A transparent rectangle for example just override the fillShape method of RectangleFigure in order to set the alpha transparency of the underlying Graphics and of course of the underlying GC.

My problem is the following one : Figures "semi-hidden" by the transparent rectangle don't received MouseEvents !!!

After looking inside Draw2d's code it seems that the SWTEventDispatcher delegates to its root figure to find the "target figure" of a MouseDown event for example. All the work is happening in findMouseEventTargetAt and in findMouseEventTargetInDescendantsAt methods of the Figure class. The findMouseEventTargetInDescendantsAt method start from the top most figure (the figure at the top right in children list) and check if it contains the "looking point", if yes it looks in its own children and then return.

In my case The transparent rectangle contains point and does not accept MouseEvents so the findMouseEventTargetInDescendantsAt returns Null without looking into figures that are "behind" this transparent rectangle.

Does anybody already encountered this need and how do you fixed it ? Maybe it will be nice to have a way to tell Draw2d figures "exclude this figure from MouseEvents look path ...

Let me know if you have any suggestions, comments or critics on the subject

Manu


Back to the top