Community
Participate
Working Groups
I have a tree view corresponding to my Graphiti View. When I select a node from the tree, using selectionchanged event, I am zooming my Graphiti View so that the entire relationship tree of the selected node will be fit in the graphiti view. Issue is that when I do a right click on the tree view, zoom happens in steps, but is interrupted when context menu is shown. If I do multiple consecutive right clicks, It keeps on saving the zoom steps. Finally when I do a left click selection, it executes all the remaining zoom steps that results in flickering. This is my observation: Problem is: Zoom happens in an animated way in 5 steps. And for each step it checks if some other interrupt is produced by the user. In case of interrupt it pauses zooming and handles the interrupt first. Rest of the Zooming steps are performed when the interrupt is handled. Now the scenario is: 1. User presses right click on the Dependency tree 2. An item is selected, so we perform the color change and Zooming. 3. Suppose one step of zooming is performed and suddenly an interrupt comes for context menu and so zooming is paused. 4. Next 5 times also user presses right click, So step 2 and 3 will be executed. and after 6th right click, total number of zooming steps is 24. 5. After that user presses left click. This time there is no interrupt and so remaining 24 zoom steps are performed at one plus 5 more for current selection. So the flickering. The interrupt handling during zoom is done in following manner: /** * Calculates the zoom-steps using a square root algorithm. */ private void zoomSqrt(double currentZoom, double targetZoom, int totalSteps) { double currentZoom2 = Math.sqrt(currentZoom); double targetZoom2 = Math.sqrt(targetZoom); double delta = (targetZoom2 - currentZoom2) / totalSteps; for (int i = 0; i < totalSteps; i++) { currentZoom2 += delta; super.primSetZoom(currentZoom2 * currentZoom2); stepPerformed(); } } /** * Is called after each performed step. * <p> * By default it dispatches all pending events of the current Display. This * is important, because typically the steps do something which shall be * visible to the user. By dispatching the events all updates to the UI will * be performed. */ public void stepPerformed() { while (true) { if (!Display.getCurrent().readAndDispatch()) break; } } Flickering will not happen, if user presses right click for longer times, as the context menu is popped up on mouse release. Number of steps and the zooming method is private to Graphiti's org.eclipse.graphiti.ui.internal.util.gef.ZoomManagerWithAnimation class. So we cannot change it.
I am using Graphiti 0.10.2.v20140217-1225
Created attachment 248625 [details] Stack Trace for Zoom Flickering