Draw2D: Automatic viewport correction? [message #229031] |
Mon, 15 January 2007 09:06 |
Cameron Bateman 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03604 seconds