RFR: JDK-8291805: IGV: Improve Zooming [v9]
Ludvig Janiuk
lujaniuk at openjdk.org
Fri Sep 9 13:41:48 UTC 2022
On Thu, 8 Sep 2022 12:32:44 GMT, Tobias Holenstein <tholenstein at openjdk.org> wrote:
>> # 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:
>
> animate Zoom to center
Hi uh, I'm not a regular in this codebase, so anything I say should be taken with the caveat that I might not know what I'm doing. With that said, I tested your PR, and zooming still seems pretty broken to me. For one, I don't notice much of a difference except for the animation. Secondly, I think a big part of what makes the zooming feel erratic is there's this "frame" around the scene that forces the zooming to take strange turns. If you'd like, maybe we can talk over zoom ( ;) ) about the zooming behavior?
-------------
PR: https://git.openjdk.org/jdk/pull/10026
More information about the hotspot-compiler-dev
mailing list