|
|
|
Re: Zest Layout Algorithmn [message #243775 is a reply to message #243761] |
Tue, 17 June 2008 14:44 |
Eclipse User |
|
|
|
Originally posted by: irbull.cs.uvic.ca
Can you open a bug (bugs.eclipse.org) under tools/gef/zest with this
suggestion?
Thanks,
Ian
Zviki wrote:
> There's a problem with the "find the item under the mouse" snippet. It
> will work, but not with scaled layouts. The coordinates need to be
> translated. Moreover, why should I care about the figure? In most
> cases, I need the node.
>
> Let me suggest the followin method for the Graph class:
>
> public GraphItem getItemAt(final int x, final int y) {
> GraphItem result = null;
> final Point point = new Point(x, y);
> getRootLayer().translateToRelative(point);
> final IFigure figureAtPoint = getFigureAt(point.x, point.y);
> if (figureAtPoint != null) {
> result = getGraphItem(figureAtPoint);
> }
> return result;
> }
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02827 seconds