Zooming in Eclipse GEF to specific location at scale 0.6-0.63 make data getting truncate

65 Views Asked by At

I am trying to zoom within my GEF application. I have already managed to get the zoom functionality working by using a ZoomManager and Actions.

.if the zoomManager.setZoom(getScale()) value is between 0.6 to 0.63. My GEF edit parts are truncating the last letter. The issue is not at any other scale level.

Can any one help me in how to proceed further.

1

There are 1 best solutions below

0
Shashwat On

Below code is to add zoom actions, level to graphical editor

ZoomManager zoomManager = rootEditPart.getZoomManager();
editor.getActionRegistry().registerAction(new ZoomInAction(zoomManager));
editor.getActionRegistry().registerAction(new ZoomOutAction(zoomManager));
List<String> zoomContributions = Arrays.asList(new String[] {ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH });
double[] zoomLevels = {0.07,0.1,0.15, 0.2, 0.3, 0.4, 0.5, 0.75, 1.0, 1.2, 1.5, 2};
zoomManager.setZoomLevelContributions(zoomContributions);
zoomManager.setZoomLevels(zoomLevels);
IAction zoomIn = new ZoomInAction(zoomManager);
IAction zoomOut = new ZoomOutAction(zoomManager);
editor.getActionRegistry().registerAction(zoomIn);
editor.getActionRegistry().registerAction(zoomOut);
IHandlerService handlerService = (IHandlerService) 
editor.getSite().getService(IHandlerService.class);
ActionHandler handler = new ActionHandler(zoomIn);
handlerService.activateHandler(GEFActionConstants.ZOOM_IN, handler);
handler = new ActionHandler(zoomOut);
handlerService.activateHandler(GEFActionConstants.ZOOM_OUT, handler);