[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.gef] Re: How to translate absolute mouse coordinates to relative coordinates in an editor

I have found a solution :o


setMouseLocation(new Point(getInputEvent().x, getInputEvent().y)); DropTarget target = (DropTarget)getInputEvent().widget;

org.eclipse.swt.graphics.Point relativePoint = target.getControl().toControl(new org.eclipse.swt.graphics.Point(getInputEvent().x,getInputEvent().y));

getMouseLocation().setLocation(relativePoint.x, relativePoint.y);
EditPart part = editPart.getViewer().findObjectAt(getMouseLocation());


If it could be useful :p


Arnaud