RFR: JDK-8291805: IGV: Improve Zooming [v3]
Tobias Holenstein
tholenstein at openjdk.org
Tue Aug 30 12:23:19 UTC 2022
> # Overview
>
> The zooming is improved in the following ways:
>
> 1) Added a minimum (10%) and maximum (400%) zoom level. If you have a sensitive mouse wheel, it can be annoying to zoom in or out too much (until the graph is invisibly small or the nodes are larger than the window)
>
> 2) Zooming with a trackpad was not very smooth because IGV did panning and zooming at the same time - Now panning is disabled when CMD/Ctrl key is pressed for zooming
>
> 3) When only a few nodes were selected, zooming was no longer mouse centred. Instead, the center of the zooming was in the upper left corner. Now the zooming is centred to the middle of the scene when all selected nodes fit in the screen.
>
> 4) Added a shortcut (Ctrl - 0) to reset the zoom level to 100%.
>
> 5) Updated the Zoom icons to be vector graphics (.svg)
>
> # Implementation
>
> 1) New functions `getZoomMinFactor()` and `getZoomMinFactor()` assure that we do not zoom in or out our infinitely. `getZoomMinFactor()` assures that we do not zoom out further if zoom level is <100% and all visible nodes already fit on the screen.
>
> 2) We introduced a new `MouseCenteredZoomAction.java` for zooming with the mouse/trackpad. `MouseCenteredZoomAction` performs panning when the modifier key is pressed (Ctrl/CMD) and zooming otherwise. The functions `zoomIn ` and `zoomOut` now do animated zooming using `CustomZoomAnimator`. `CustomZoomAnimator` uses the mouse location as the centre of the zoom animation.
>
> 3) The `JScrollPane` now has a `JPanel centeringPanel` with `GridBagLayout()` that contains the `viewComponent`. This assures that the `viewComponent` is always centred when no scrollbars are visible. This makes the `Widget topLeft, bottomRight` obsolete as we can now add a white border of `BORDER_SIZE` to the `DiagramScene` instead.
>
> 4) `ZoomResetAction.java` resets the zoom level to 100%. The shortcut is `Ctrl - 0` and the action is available in the menu: `View` -> `Reset Zoom`. It was not added to the icon menu bar in the `EditorTopComponent` because of space issue.
>
> 5) new self created icons with vector graphics: `zoomIn.svg`, `zoomOut.svg` and `zoomReset.svg`
Tobias Holenstein has updated the pull request incrementally with one additional commit since the last revision:
ZOOM_INCREMENT = 1.3
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10026/files
- new: https://git.openjdk.org/jdk/pull/10026/files/3575bffc..2843c3c4
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10026&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10026&range=01-02
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/10026.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10026/head:pull/10026
PR: https://git.openjdk.org/jdk/pull/10026
More information about the hotspot-compiler-dev
mailing list