Skip to content

Commit

Permalink
Merge pull request #3294 from soetji/fix/breadthfirst-in-cy-extent
Browse files Browse the repository at this point in the history
Fix breadthfirst layout to stay inside viewport on fit: false and no boundingBox
  • Loading branch information
mikekucera authored Nov 11, 2024
2 parents 14b3730 + f2b8b8d commit dd0e9f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/extensions/layout/breadthfirst.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ BreadthFirstLayout.prototype.run = function(){
const maximal = options.acyclic || options.maximal || options.maximalAdjustments > 0; // maximalAdjustments for compat. w/ old code; also, setting acyclic to true sets maximal to true

const hasBoundingBox = !!options.boundingBox;
const cyExtent = cy.extent();
const bb = math.makeBoundingBox( hasBoundingBox ? options.boundingBox : {
x1: 0, y1: 0, w: cy.width(), h: cy.height()
x1: cyExtent.x1, y1: cyExtent.y1, w: cyExtent.w, h: cyExtent.h
} );

let roots;
Expand Down

0 comments on commit dd0e9f8

Please sign in to comment.