Skip to content

Commit

Permalink
Fix initial values for average node size
Browse files Browse the repository at this point in the history
  • Loading branch information
soetji committed Nov 8, 2024
1 parent 80c4240 commit 32a0bda
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/extensions/layout/breadthfirst.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,13 @@ BreadthFirstLayout.prototype.run = function(){
y: bb.y1 + bb.h / 2
};

// average node size
const aveNodeSize = nodes.reduce((acc, node) => ((box) => ({
w: acc.w === null ? box.w : (acc.w + box.w) / 2,
h: acc.h === null ? box.h : (acc.h + box.h) / 2,
w: acc.w === -1 ? box.w : (acc.w + box.w) / 2,
h: acc.h === -1 ? box.h : (acc.h + box.h) / 2,
}))(node.boundingBox({
includeLabels: options.nodeDimensionsIncludeLabels
})), { w: null, h: null });
})), { w: -1, h: -1 });

const distanceY = Math.max(
// only one depth
Expand Down

0 comments on commit 32a0bda

Please sign in to comment.