我正在尝试放大我的GEF应用程序。我已经设法通过使用ZoomManager和Actions来使缩放功能正常工作。
。如果zoomManager.setZoom(getScale())值介于0.6到0.63之间。我的GEF编辑部分正在截断最后一个字母。 问题不在任何其他规模水平。
任何人都可以帮助我进一步处理。
答案 0 :(得分:1)
下面的代码是添加缩放操作,级别到图形编辑器
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);