Drawing outside a Figure's bounds [message #249042] |
Sun, 24 May 2009 09:10  |
Eclipse User |
|
|
|
For a GEF editor, I'd like to draw a little crosshair for each shape that
I'm displaying, indicating its point of origin. The crosshair should just
be visible, but not be selectable or change the figure's bounds.
When I'm drawing it using the Figure's paintFigure(Graphics) method, it
isn't visible if it's not inside the figure's bounds.
Is there some way to temporarily expand the clipping area without changing
the bounds?
Or would it be easier to have the crosshair be a separate figure, that is
somehow linked to the shape, and updated together with it?
Regards,
Gerrit
|
|
|
Re: Drawing outside a Figure's bounds [message #249163 is a reply to message #249042] |
Thu, 04 June 2009 01:34  |
Eclipse User |
|
|
|
Hi,
This is possible. In GMF there's a cncept of a BorderedNodeFigure and
BorderItemContainerFigure.
However, I'd advice not to play around with clipping regions.
Try combining the crosshair with the figure it's associated with, so
bounds of the figure include the crosshair. Paint the crosshair within
your figure paintFigure method, make sure you don't call fillRectangle or
any fill methods on the big bounds (might as well set opaque flag on the
figure). For the figure override #containtPoint(x,y) such that it returns
true for the point inside your "main" figure. Also you'd probaly have to
override #handleBounds() on the editpart to show the selection and re-size
handles on the "main" figure only. Some edit policies may need to be
overriden.
Also alternative solution can be found. Show crosshair when the shape is
selected for example... In this case you'd show the crosshair in the
"handle" layer, such that you don't have to worry about clipping etc.
Hope this helps.
Cheers,
Alex
|
|
|
Powered by
FUDForum. Page generated in 0.04244 seconds