Skip to content

Commit

Permalink
fix: add return value for grid layout (antvis#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
NewByVector committed Jul 26, 2021
1 parent 54b75b9 commit 3c8abfe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/layout/grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,27 @@ export class GridLayout extends Base {
public execute() {
const self = this;
const nodes = self.nodes;
const edges = self.edges;
const n = nodes.length;
const begin = self.begin;
if (n === 0) {
if (self.onLayoutEnd) self.onLayoutEnd();
return;
return {
nodes,
edges
};
}
if (n === 1) {
nodes[0].x = begin[0];
nodes[0].y = begin[1];
if (self.onLayoutEnd) self.onLayoutEnd();
return;
return {
nodes,
edges,
};
}

const edges = self.edges;

const layoutNodes: INode[] = [];
nodes.forEach((node) => {
layoutNodes.push(node);
Expand Down

0 comments on commit 3c8abfe

Please sign in to comment.