mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
fixed initial scaling on small native display graph
This commit is contained in:
@@ -1079,7 +1079,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
|||||||
.elements(vertices)
|
.elements(vertices)
|
||||||
.maxFactor(.05)
|
.maxFactor(.05)
|
||||||
.buttonSupplier(JRadioButton::new)
|
.buttonSupplier(JRadioButton::new)
|
||||||
.paintFunction(v -> graphDisplayOptions.getVertexColor(v))
|
.paintFunction(v -> Color.BLACK)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
vertexFilters.addItemListener(item -> {
|
vertexFilters.addItemListener(item -> {
|
||||||
@@ -1097,7 +1097,7 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
|||||||
.elements(edges)
|
.elements(edges)
|
||||||
.maxFactor(.01)
|
.maxFactor(.01)
|
||||||
.buttonSupplier(JRadioButton::new)
|
.buttonSupplier(JRadioButton::new)
|
||||||
.paintFunction(e -> graphDisplayOptions.getEdgeColor(e))
|
.paintFunction(e -> Color.BLACK)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
edgeFilters.addItemListener(item -> {
|
edgeFilters.addItemListener(item -> {
|
||||||
@@ -1115,8 +1115,16 @@ public class DefaultGraphDisplay implements GraphDisplay {
|
|||||||
*/
|
*/
|
||||||
private void configureViewerPreferredSize() {
|
private void configureViewerPreferredSize() {
|
||||||
int vertexCount = graph.vertexSet().size();
|
int vertexCount = graph.vertexSet().size();
|
||||||
// attempt to set a reasonable size for the layout based on the number of vertices
|
|
||||||
Dimension viewSize = viewer.getPreferredSize();
|
Dimension viewSize = viewer.getPreferredSize();
|
||||||
|
|
||||||
|
// set the layoutModel's initials size to a minimal value. Not sure this should be necessary
|
||||||
|
// but it makes the initial scaling look better for small graphs. Otherwise it seems
|
||||||
|
// to use a very large area to layout the graph, resulting in tiny nodes that are spaced
|
||||||
|
// very far apart. This might just be a work around for a bug in some of the layout
|
||||||
|
// algorithms that don't seem to properly compute a good layout size.
|
||||||
|
viewer.getVisualizationModel().getLayoutModel().setSize(1, 1);
|
||||||
|
|
||||||
if (vertexCount < 100) {
|
if (vertexCount < 100) {
|
||||||
viewer.getVisualizationModel()
|
viewer.getVisualizationModel()
|
||||||
.getLayoutModel()
|
.getLayoutModel()
|
||||||
|
|||||||
Reference in New Issue
Block a user