Skip to content

Commit

Permalink
Improved box layouting
Browse files Browse the repository at this point in the history
Respect padding in total area for calculating box layout algorithm's
width
  • Loading branch information
stu241636 committed Nov 8, 2024
1 parent c5f5fe1 commit f312f74
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ private KVector placeBoxes(final List<ElkNode> 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)
Expand Down

0 comments on commit f312f74

Please sign in to comment.