RFR: JDK-8302846: IGV: Zoom stuck when zooming out on large graphs [v2]

Tobias Holenstein tholenstein at openjdk.org
Tue Feb 21 13:53:05 UTC 2023


> # Problem 
> In the IdealGraphVisualizer (IGV) the user can zoom in and out using either the mouse-wheel or by entering/selecting a value in the zoom combo-box. The zoom combo-box is implemented in `ZoomLevelAction.java`: 
> - `ZoomLevelAction` has a listener on `scene.getZoomChangedEvent()` which calls `changed(..)` each time the zoom level of the `diagramScene` changes, e.g. when the user zooms in/out with the mouse-wheel. 
> - `actionPerformed(..)` is called when the user enters/selects a zoom level in the combo-box, in which case it calls `setZoomLevel(..)` -> `diagramScene.setZoomPercentage(zoomLevel)` to update the zooming of the scene. 
> - `changed(..)` calls `setSelectedItem(..)` which updates the content of the combo-box and triggers a also a call to `actionPerformed(..)`. Unfortunately, in this case we should not call `diagramScene.setZoomPercentage(zoomLevel)` because the `diagramScene` is updating the `ZoomLevelAction` and not vice versa. The problem only reveals for small zooming level because `ZoomLevelAction` uses an integer for the zooming level (1-100%) while the `diagramScene` uses a float (1.0f is 100%). In the example where the bug occurs, mouse wheel zooming changed zoom level in `diagramScene` from 0.01 to 0.012 -  then `diagramScene` updates the `ZoomLevelAction` which rounds 1.2% to 1% :  and now the BUG: `ZoomLevelAction ` sets `diagramScene` zooming again to 0.01. The zooming is stuck at 0.01
> 
> # Solution
> When `diagramScene` updates the `ZoomLevelAction`, `actionPerformed(..)` should not call `diagramScene.setZoomPercentage(zoomLevel)`. So we introduce a ` boolean updateZoomInScene` that is set to `false` when a change of zoom in `diagramScene ` triggered the  `actionPerformed(..)`

Tobias Holenstein has updated the pull request incrementally with one additional commit since the last revision:

  update copyright year

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/12652/files
  - new: https://git.openjdk.org/jdk/pull/12652/files/9f97bf39..913386be

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12652&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12652&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/12652.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12652/head:pull/12652

PR: https://git.openjdk.org/jdk/pull/12652


More information about the hotspot-compiler-dev mailing list