Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Draw2D: Automatic viewport correction?
Draw2D: Automatic viewport correction? [message #229031] Mon, 15 January 2007 09:06 Go to next message
Cameron Bateman is currently offline Cameron BatemanFriend
Messages: 481
Registered: July 2009
Senior Member
I am looking for a standard function that will allow me to translate a
rectangle so that it is always in the viewport. I can see how I can do it
myself, but it seems like something pretty basic so I'm wondering if
Draw2D already can do it.

The idea is this: I have a rectangular edit part figure. If (0,0) is the
relative top-left of the edit part, then I want to draw a small square
handle at (w,0) (w is the width of the figure) when the edit part gets the
mouse hover. But what if, for example, (w,0) translates to an absolute
coordinate that is outside the current viewport of the contents figure?
If this happens, I would like to translate the handle to a position that
is guaranteed to be inside the viewport.

I think I may be able to do this myself using Rectangle.intersect(handle,
viewPortRectangle) then using the complement (the rectangle not
intersecting) to determine how the handle needs to be translated. But is
there a more standard way in Draw2D to do this?


Thanks,

Cameron
Re: Draw2D: Automatic viewport correction? [message #229566 is a reply to message #229031] Mon, 22 January 2007 10:39 Go to previous message
Cameron Bateman is currently offline Cameron BatemanFriend
Messages: 481
Registered: July 2009
Senior Member
Anyone have any ideas on this topic?
Previous Topic:fixing center of window to be 0,0 with FreeformLayer
Next Topic:EditPart figures in feedback layer
Goto Forum:
  


Current Time: Thu Apr 25 09:52:41 GMT 2024

Powered by FUDForum. Page generated in 0.03158 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top