Skip to content

Commit

Permalink
8302846: IGV: Zoom stuck when zooming out on large graphs
Browse files Browse the repository at this point in the history
Reviewed-by: rcastanedalo, thartmann
  • Loading branch information
tobiasholenstein committed Feb 21, 2023
1 parent 92dfa11 commit 02eb240
Showing 1 changed file with 9 additions and 3 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -40,6 +40,8 @@ public final class ZoomLevelAction extends JComboBox<String> implements ChangedL

private final DiagramViewer diagramScene;

boolean updateZoomInScene = true;

@Override
public void actionPerformed(ActionEvent e) {
EditorTopComponent editor = EditorTopComponent.getActive();
Expand All @@ -58,6 +60,9 @@ public void actionPerformed(ActionEvent e) {
level = Math.max(level, minLevel);
level = Math.min(level, maxLevel);
setZoomLevel(level);
if (updateZoomInScene) {
diagramScene.setZoomPercentage(level);
}
} catch(NumberFormatException exception) {
changed(diagramScene);
}
Expand All @@ -84,11 +89,12 @@ public ZoomLevelAction(DiagramViewer scene) {

private void setZoomLevel(int zoomLevel) {
setSelectedItem(zoomLevel + "%");
diagramScene.setZoomPercentage(zoomLevel);
}

@Override
public void changed(DiagramViewer diagramViewer) {
setSelectedItem(diagramViewer.getZoomPercentage() + "%");
updateZoomInScene = false;
setZoomLevel(diagramViewer.getZoomPercentage());
updateZoomInScene = true;
}
}

1 comment on commit 02eb240

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.