Skip to content

Commit 55fee1e

Browse files
authored
perf: init node positions when the node has no x and y in the origin data; (#4014)
1 parent ce0dbae commit 55fee1e

File tree

11 files changed

+25
-22
lines changed

11 files changed

+25
-22
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog
22

3+
### 4.7.9
4+
5+
- perf: init node positions when the node has no x and y in the origin data;
6+
37
### 4.7.8
48

59
- feat: pointPadding config for loop edges with non-circle nodes, closes: #3974;

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g6-core",
3-
"version": "0.7.8",
3+
"version": "0.7.9",
44
"description": "A Graph Visualization Framework in JavaScript",
55
"keywords": [
66
"antv",

packages/core/src/global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const colorSet = {
6464
};
6565

6666
export default {
67-
version: '0.7.8',
67+
version: '0.7.9',
6868
rootContainerClassName: 'root-container',
6969
nodeContainerClassName: 'node-container',
7070
edgeContainerClassName: 'edge-container',

packages/core/src/graph/controller/layout.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,10 @@ export default abstract class LayoutController {
308308
if (!nodes) {
309309
return false;
310310
}
311-
const nodeLength = nodes ? nodes.length : 0;
311+
const nodesToInit = nodes.filter(node => isNaN(node.x) || isNaN(node.y))
312+
const nodeLength = nodesToInit ? nodesToInit.length : 0;
312313
if (!nodeLength) return;
313-
314314
const hasPreset = this.initWithPreset?.();
315-
316315
if (hasPreset) return false;
317316

318317
const width = graph.get('width') * 0.85;
@@ -328,7 +327,7 @@ export default abstract class LayoutController {
328327

329328
let allHavePos = true;
330329
for (let i = 0; i < nodeLength; i++) {
331-
const node = nodes[i];
330+
const node = nodesToInit[i];
332331
if (isNaN(+node.x)) {
333332
allHavePos = false;
334333
node.x = (i % horiNum) * horiGap + beginX;

packages/element/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g6-element",
3-
"version": "0.7.8",
3+
"version": "0.7.9",
44
"description": "A Graph Visualization Framework in JavaScript",
55
"keywords": [
66
"antv",
@@ -61,7 +61,7 @@
6161
},
6262
"dependencies": {
6363
"@antv/g-base": "^0.5.1",
64-
"@antv/g6-core": "0.7.8",
64+
"@antv/g6-core": "0.7.9",
6565
"@antv/util": "~2.0.5"
6666
},
6767
"devDependencies": {

packages/g6/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g6",
3-
"version": "4.7.8",
3+
"version": "4.7.9",
44
"description": "A Graph Visualization Framework in JavaScript",
55
"keywords": [
66
"antv",
@@ -66,7 +66,7 @@
6666
]
6767
},
6868
"dependencies": {
69-
"@antv/g6-pc": "0.7.8"
69+
"@antv/g6-pc": "0.7.9"
7070
},
7171
"devDependencies": {
7272
"@babel/core": "^7.7.7",

packages/g6/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import G6 from '@antv/g6-pc';
22

3-
G6.version = '4.7.8';
3+
G6.version = '4.7.9';
44

55
export * from '@antv/g6-pc';
66
export default G6;
7-
export const version = '4.7.8';
7+
export const version = '4.7.9';

packages/pc/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g6-pc",
3-
"version": "0.7.8",
3+
"version": "0.7.9",
44
"description": "A Graph Visualization Framework in JavaScript",
55
"keywords": [
66
"antv",
@@ -75,9 +75,9 @@
7575
"@antv/g-canvas": "^0.5.2",
7676
"@antv/g-math": "^0.1.1",
7777
"@antv/g-svg": "^0.5.1",
78-
"@antv/g6-core": "0.7.8",
79-
"@antv/g6-element": "0.7.8",
80-
"@antv/g6-plugin": "0.7.8",
78+
"@antv/g6-core": "0.7.9",
79+
"@antv/g6-element": "0.7.9",
80+
"@antv/g6-plugin": "0.7.9",
8181
"@antv/hierarchy": "^0.6.7",
8282
"@antv/layout": "^0.3.0",
8383
"@antv/matrix-util": "^3.1.0-beta.3",

packages/pc/src/global.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const textColor = 'rgb(0, 0, 0)';
77
const colorSet = getColorsWithSubjectColor(subjectColor, backColor);
88

99
export default {
10-
version: '0.7.8',
10+
version: '0.7.9',
1111
rootContainerClassName: 'root-container',
1212
nodeContainerClassName: 'node-container',
1313
edgeContainerClassName: 'edge-container',

packages/plugin/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@antv/g6-plugin",
3-
"version": "0.7.8",
3+
"version": "0.7.9",
44
"description": "G6 Plugin",
55
"main": "lib/index.js",
66
"module": "es/index.js",
@@ -22,8 +22,8 @@
2222
"@antv/g-base": "^0.5.1",
2323
"@antv/g-canvas": "^0.5.2",
2424
"@antv/g-svg": "^0.5.2",
25-
"@antv/g6-core": "0.7.8",
26-
"@antv/g6-element": "0.7.8",
25+
"@antv/g6-core": "0.7.9",
26+
"@antv/g6-element": "0.7.9",
2727
"@antv/matrix-util": "^3.1.0-beta.3",
2828
"@antv/scale": "^0.3.4",
2929
"@antv/util": "^2.0.9",

0 commit comments

Comments
 (0)