From f312f74eb3cea793cfcc5a20aac77db23628cefe Mon Sep 17 00:00:00 2001 From: Tobias Weimar Date: Fri, 8 Nov 2024 15:54:08 +0100 Subject: [PATCH] Improved box layouting Respect padding in total area for calculating box layout algorithm's width --- .../src/org/eclipse/elk/core/util/BoxLayoutProvider.java | 2 ++ 1 file changed, 2 insertions(+) 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 6170bade68..973984b651 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,8 @@ private KVector placeBoxes(final List sortedBoxes, final double minSpac double stddev = areaStdDev(sortedBoxes, mean); totalArea += (sortedBoxes.size() * 1 * stddev); + // add padding to total area + totalArea += Math.sqrt(totalArea) * (padding.getBottom() + padding.getTop()); // 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)