|
16 | 16 | import org.eclipse.elk.alg.rectpacking.util.DrawingData; |
17 | 17 | import org.eclipse.elk.alg.rectpacking.util.DrawingDataDescriptor; |
18 | 18 | import org.eclipse.elk.alg.rectpacking.util.RectRow; |
| 19 | +import org.eclipse.elk.core.math.ElkPadding; |
19 | 20 | import org.eclipse.elk.core.math.KVector; |
20 | 21 | import org.eclipse.elk.core.util.IElkProgressMonitor; |
21 | 22 | import org.eclipse.elk.graph.ElkNode; |
@@ -69,7 +70,7 @@ public RowFillingAndCompaction(final double aspectRatio, final boolean expandNod |
69 | 70 | * @return Drawing data for a produced drawing. |
70 | 71 | */ |
71 | 72 | public DrawingData start(final List<ElkNode> rectangles, final double maxWidth, final KVector minParentSize, |
72 | | - final IElkProgressMonitor progressMonitor, final ElkNode layoutGraph) { |
| 73 | + final IElkProgressMonitor progressMonitor, final ElkNode layoutGraph, final ElkPadding padding) { |
73 | 74 | // Initial placement for rectangles in blocks in each row. |
74 | 75 | List<RectRow> rows = InitialPlacement.place(rectangles, maxWidth, nodeNodeSpacing); |
75 | 76 |
|
@@ -107,8 +108,8 @@ public DrawingData start(final List<ElkNode> rectangles, final double maxWidth, |
107 | 108 | progressMonitor.logGraph(layoutGraph, "After compaction"); |
108 | 109 | } |
109 | 110 |
|
110 | | - double totalWidth = Math.max(this.drawingWidth, minParentSize.x); |
111 | | - double minHeight = Math.max(this.drawingHeight, minParentSize.y); |
| 111 | + double totalWidth = Math.max(this.drawingWidth, minParentSize.x - padding.getHorizontal()); |
| 112 | + double minHeight = Math.max(this.drawingHeight, minParentSize.y - padding.getVertical()); |
112 | 113 | double additionalHeight = minHeight - this.drawingHeight; |
113 | 114 | if (expandNodes && expandToAspectRatio) { |
114 | 115 | double aspectRatio = totalWidth / minHeight; |
|
0 commit comments