diff --git a/plugins/org.eclipse.elk.core/src/org/eclipse/elk/core/util/BoxLayoutProvider.java b/plugins/org.eclipse.elk.core/src/org/eclipse/elk/core/util/BoxLayoutProvider.java index 6170bade6..9e94ea261 100644 --- a/plugins/org.eclipse.elk.core/src/org/eclipse/elk/core/util/BoxLayoutProvider.java +++ b/plugins/org.eclipse.elk.core/src/org/eclipse/elk/core/util/BoxLayoutProvider.java @@ -194,6 +194,11 @@ private KVector placeBoxes(final List sortedBoxes, final double minSpac double stddev = areaStdDev(sortedBoxes, mean); totalArea += (sortedBoxes.size() * 1 * stddev); + // add top and bottom padding to total area + totalArea += Math.sqrt(totalArea) * (padding.getBottom() + padding.getTop()); + // add left and right padding + totalArea += Math.sqrt(totalArea) * (padding.getRight()); + // calculate the required row width w to achieve the desired aspect ratio, // i.e.: w*h=area s.t. w/h=dar -> w=sqrt(area * dar)