diff --git a/plugins/org.eclipse.elk.alg.vertiflex/src/org/eclipse/elk/alg/vertiflex/p4edgerouting/Edgerouter.java b/plugins/org.eclipse.elk.alg.vertiflex/src/org/eclipse/elk/alg/vertiflex/p4edgerouting/Edgerouter.java index 38d9524cb..7697f5b97 100644 --- a/plugins/org.eclipse.elk.alg.vertiflex/src/org/eclipse/elk/alg/vertiflex/p4edgerouting/Edgerouter.java +++ b/plugins/org.eclipse.elk.alg.vertiflex/src/org/eclipse/elk/alg/vertiflex/p4edgerouting/Edgerouter.java @@ -13,6 +13,7 @@ import org.eclipse.elk.alg.vertiflex.VertiFlexLayoutPhases; import org.eclipse.elk.core.alg.ILayoutPhase; import org.eclipse.elk.core.alg.LayoutProcessorConfiguration; +import org.eclipse.elk.core.math.ElkMargin; import org.eclipse.elk.core.math.ElkPadding; import org.eclipse.elk.core.options.CoreOptions; import org.eclipse.elk.core.util.ElkUtil; @@ -77,10 +78,21 @@ private void routeEdges(final ElkNode node) { private void setCanvas(final ElkNode graph) { ElkPadding padding = graph.getProperty(CoreOptions.PADDING); - ElkUtil.computeChildAreaDimensions(graph); + double maxX = 0.0; + double maxY = 0.0; + for (ElkNode node : graph.getChildren()) { + ElkMargin margin = node.getProperty(CoreOptions.MARGINS); - graph.setWidth(graph.getProperty(CoreOptions.CHILD_AREA_WIDTH) + padding.left + padding.right); - graph.setHeight(graph.getProperty(CoreOptions.CHILD_AREA_HEIGHT) + padding.top + padding.bottom); + if (maxX < node.getX() + node.getWidth() + margin.right) { + maxX = node.getX() + node.getWidth() + margin.right; + } + if (maxY < node.getY() + node.getHeight() + margin.bottom) { + maxY = node.getY() + node.getHeight() + margin.bottom; + } + } + + graph.setWidth(maxX + padding.right); + graph.setHeight(maxY + padding.bottom); } }