Skip to content

Commit

Permalink
fix(core): filter NaN cases in getVirtualRectSize
Browse files Browse the repository at this point in the history
  • Loading branch information
wumail authored and boyongjiong committed Oct 19, 2023
1 parent fabd8d7 commit 045e80b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/core/src/model/GraphModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1214,8 +1214,12 @@ class GraphModel {
nodes.forEach((node) => {
const { x, y, width, height } = node;
const { strokeWidth = 0 } = node.getNodeStyle();
nodesX = nodesX.concat([x + width / 2 + strokeWidth, x - width / 2 - strokeWidth]);
nodesY = nodesY.concat([y + height / 2 + strokeWidth, y - height / 2 - strokeWidth]);
const maxX = x + width / 2 + strokeWidth;
const minX = x - width / 2 - strokeWidth;
const maxY = y + height / 2 + strokeWidth;
const minY = y - height / 2 - strokeWidth;
nodesX = nodesX.concat([maxX, minX].filter(num => !Number.isNaN(num)));
nodesY = nodesY.concat([maxY, minY].filter(num => !Number.isNaN(num)));
});

const minX = Math.min(...nodesX);
Expand Down

0 comments on commit 045e80b

Please sign in to comment.