Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-469 Graph Satellite View is sometimes truncated

Tom Nelson54ceb189bfb0
diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java
index 9abd56e378..57c495cc20 100644
--- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java
+++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java
@@ -192,6 +192,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
Dimension sd = satelliteViewer.getSize();
java.awt.Point p = new java.awt.Point(vvd.width - sd.width, vvd.height - sd.height);
satelliteViewer.getComponent().setBounds(p.x, p.y, sd.width, sd.height);
+ satelliteViewer.scaleToLayout();
}
});
@@ -303,7 +304,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
new ActionBuilder("Reset View", ACTION_OWNER)
.description("Fit Graph to Window")
.toolBarIcon(DefaultDisplayGraphIcons.FIT_TO_WINDOW)
- .onAction(context -> viewer.scaleToLayout())
+ .onAction(context -> centerAndScale())
.buildAndInstallLocal(componentProvider);
// create a button to show the view magnify lens
@@ -774,6 +775,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
configureFilters();
LayoutAlgorithm<AttributedVertex> initialLayoutAlgorithm =
layoutTransitionManager.getInitialLayoutAlgorithm();
+ initialLayoutAlgorithm.setAfter(() -> centerAndScale());
viewer.getVisualizationModel().setLayoutAlgorithm(initialLayoutAlgorithm);
});
componentProvider.setVisible(true);
@@ -924,6 +926,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
*/
public void centerAndScale() {
viewer.scaleToLayout();
+ satelliteViewer.scaleToLayout();
}
/**
@@ -1026,7 +1029,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
public void ancestorAdded(AncestorEvent ancestorEvent) {
vv.getComponent().removeAncestorListener(this);
Swing.runLater(() -> {
- vv.scaleToLayout();
+ centerAndScale();
});
}