Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Getting the right location after scrolling
Getting the right location after scrolling [message #65778] Wed, 19 February 2003 22:23 Go to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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 ?
>
Previous Topic:Change the Figure after it is first created
Next Topic:example link
Goto Forum:
  


Current Time: Sat Aug 17 22:25:02 GMT 2024

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

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

Back to the top