Navigating to figure (in scalable editors) [message #543530] |
Tue, 29 June 2010 17:09 |
Jakub Fibinger Messages: 2 Registered: June 2010 |
Junior Member |
|
|
Hi,
I've problem with scaling in editor.
The goal is to make navigating method in scalable editor class, that will put node in the center of viewport. I've implemented it like this:
@Override
public void navigateToElement(IElement element) {
Point elementCoords = ((IVisualSchemaBasicNode)element).getLocation().getCopy();
Dimension viewDimension = getEditorViewport().getClientArea().getSize().getCopy();
elementCoords.translate(viewDimension.getNegated().getScaled(0.5));
getEditorViewport().setViewLocation(elementCoords);
}
The problem is that it works well only in case that zoom is set to 100%. Otherwise the view is displaced.
The question is: how to add scaling logic to this code?
Please help me, or just tell me which GEF object should I consider (where should I look for a solution).
[Updated on: Tue, 29 June 2010 20:45] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02325 seconds