/** {@inheritDoc} */ @Override public void applyLayout() { // applying the compacted positions applyNodePositions(); // calculating new graph size and offset KVector topLeft = new KVector(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); KVector bottomRight = new KVector(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); for (CNode cNode : cGraph.cNodes) { topLeft.x = Math.min(topLeft.x, cNode.hitbox.x); topLeft.y = Math.min(topLeft.y, cNode.hitbox.y); bottomRight.x = Math.max(bottomRight.x, cNode.hitbox.x + cNode.hitbox.width); bottomRight.y = Math.max(bottomRight.y, cNode.hitbox.y + cNode.hitbox.height); } layeredGraph.getOffset().reset().add(topLeft.clone().negate()); layeredGraph.getSize().reset().add(bottomRight.clone().sub(topLeft)); // resetting lists cGraph.cGroups.clear(); cGraph.cNodes.clear(); }