Getting the right location after scrolling [message #65778] |
Wed, 19 February 2003 22:23 |
Eclipse User |
|
|
|
Originally posted by: beneyal.hotmail.com
I wrote a tool that gets the mouse click inside my editor. After the mouse
is clicked, it checks whether the click was inside one of the draw2d
figures on the screen.
The problem starts after scrolling down using the editor's scroll bar
(when the figures take more than the size of the screen). After scrolling
the location of the mouse click is different from the changed location of
the figures.
How can I solve this problem ?
|
|
|
Re: Getting the right location after scrolling [message #65800 is a reply to message #65778] |
Thu, 20 February 2003 01:34 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
The viewport and possible other figures apply their own coordinate systems
to the figures they contain. You should either start with the root figure,
and do a findFigureAt(Point pt), or if you have a single figure that you are
trying to check for, you should get that figure's absolute bounds by doing:
Rectangle r = figure.getBounds().getCopy();
figure.translateToAbsolute(r);
Then do a r.contains(mouseLocation);
"Eyal" <beneyal@hotmail.com> wrote in message
news:b3105p$i41$1@rogue.oti.com...
> I wrote a tool that gets the mouse click inside my editor. After the mouse
> is clicked, it checks whether the click was inside one of the draw2d
> figures on the screen.
> The problem starts after scrolling down using the editor's scroll bar
> (when the figures take more than the size of the screen). After scrolling
> the location of the mouse click is different from the changed location of
> the figures.
> How can I solve this problem ?
>
|
|
|
Powered by
FUDForum. Page generated in 0.39299 seconds