Skip to content

Commit

Permalink
rectpacking: Do node micro layout before and after layout.
Browse files Browse the repository at this point in the history
Previously it was only done after because whitespace elimination might
change node sizes. However, if the node size cannot fit the label, we
need to do this before the layout too.
  • Loading branch information
soerendomroes committed Feb 12, 2024
1 parent afdaf12 commit 2144d91
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public void layout(final ElkNode layoutGraph, final IElkProgressMonitor progress
boolean tryBox = layoutGraph.getProperty(RectPackingOptions.TRYBOX);
List<ElkNode> rectangles = layoutGraph.getChildren();

// if requested, compute nodes's dimensions, place node labels, ports, port labels, etc.
if (!layoutGraph.getProperty(RectPackingOptions.OMIT_NODE_MICRO_LAYOUT)) {
NodeMicroLayout.forGraph(layoutGraph).execute();
}

// Check whether regions are stackable and do box layout instead.
boolean stackable = false;
if (tryBox && rectangles.size() >= 3) {
Expand Down Expand Up @@ -129,7 +134,7 @@ public void layout(final ElkNode layoutGraph, final IElkProgressMonitor progress
layoutGraph.getProperty(InternalProperties.DRAWING_HEIGHT) + padding.getVertical(), false, true);
}

// if requested, compute nodes's dimensions, place node labels, ports, port labels, etc.
// Do micro layout again since the whitspace elimination and other things might have changed node sizes.
if (!layoutGraph.getProperty(RectPackingOptions.OMIT_NODE_MICRO_LAYOUT)) {
NodeMicroLayout.forGraph(layoutGraph).execute();
}
Expand Down

0 comments on commit 2144d91

Please sign in to comment.