diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d7398bbdd1..1000b84cc72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +### 4.7.9 + +- perf: init node positions when the node has no x and y in the origin data; + ### 4.7.8 - feat: pointPadding config for loop edges with non-circle nodes, closes: #3974; diff --git a/packages/core/package.json b/packages/core/package.json index 32ac658d7ff..59148446451 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-core", - "version": "0.7.8", + "version": "0.7.9", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", diff --git a/packages/core/src/global.ts b/packages/core/src/global.ts index eb5f8f39f46..d508526bc41 100644 --- a/packages/core/src/global.ts +++ b/packages/core/src/global.ts @@ -64,7 +64,7 @@ const colorSet = { }; export default { - version: '0.7.8', + version: '0.7.9', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', diff --git a/packages/core/src/graph/controller/layout.ts b/packages/core/src/graph/controller/layout.ts index 2a50ddd8ed3..08f7d090cd6 100644 --- a/packages/core/src/graph/controller/layout.ts +++ b/packages/core/src/graph/controller/layout.ts @@ -308,11 +308,10 @@ export default abstract class LayoutController { if (!nodes) { return false; } - const nodeLength = nodes ? nodes.length : 0; + const nodesToInit = nodes.filter(node => isNaN(node.x) || isNaN(node.y)) + const nodeLength = nodesToInit ? nodesToInit.length : 0; if (!nodeLength) return; - const hasPreset = this.initWithPreset?.(); - if (hasPreset) return false; const width = graph.get('width') * 0.85; @@ -328,7 +327,7 @@ export default abstract class LayoutController { let allHavePos = true; for (let i = 0; i < nodeLength; i++) { - const node = nodes[i]; + const node = nodesToInit[i]; if (isNaN(+node.x)) { allHavePos = false; node.x = (i % horiNum) * horiGap + beginX; diff --git a/packages/element/package.json b/packages/element/package.json index 84e8cae3d72..f35f9dadf5c 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-element", - "version": "0.7.8", + "version": "0.7.9", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -61,7 +61,7 @@ }, "dependencies": { "@antv/g-base": "^0.5.1", - "@antv/g6-core": "0.7.8", + "@antv/g6-core": "0.7.9", "@antv/util": "~2.0.5" }, "devDependencies": { diff --git a/packages/g6/package.json b/packages/g6/package.json index 5a67a8e8129..c4d9547c4fe 100644 --- a/packages/g6/package.json +++ b/packages/g6/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6", - "version": "4.7.8", + "version": "4.7.9", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -66,7 +66,7 @@ ] }, "dependencies": { - "@antv/g6-pc": "0.7.8" + "@antv/g6-pc": "0.7.9" }, "devDependencies": { "@babel/core": "^7.7.7", diff --git a/packages/g6/src/index.ts b/packages/g6/src/index.ts index 2ef104c2706..fc813f46945 100644 --- a/packages/g6/src/index.ts +++ b/packages/g6/src/index.ts @@ -1,7 +1,7 @@ import G6 from '@antv/g6-pc'; -G6.version = '4.7.8'; +G6.version = '4.7.9'; export * from '@antv/g6-pc'; export default G6; -export const version = '4.7.8'; +export const version = '4.7.9'; diff --git a/packages/pc/package.json b/packages/pc/package.json index 761ce5195ef..8f51e085234 100644 --- a/packages/pc/package.json +++ b/packages/pc/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-pc", - "version": "0.7.8", + "version": "0.7.9", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -75,9 +75,9 @@ "@antv/g-canvas": "^0.5.2", "@antv/g-math": "^0.1.1", "@antv/g-svg": "^0.5.1", - "@antv/g6-core": "0.7.8", - "@antv/g6-element": "0.7.8", - "@antv/g6-plugin": "0.7.8", + "@antv/g6-core": "0.7.9", + "@antv/g6-element": "0.7.9", + "@antv/g6-plugin": "0.7.9", "@antv/hierarchy": "^0.6.7", "@antv/layout": "^0.3.0", "@antv/matrix-util": "^3.1.0-beta.3", diff --git a/packages/pc/src/global.ts b/packages/pc/src/global.ts index 86eba0a578b..c31769cddc8 100644 --- a/packages/pc/src/global.ts +++ b/packages/pc/src/global.ts @@ -7,7 +7,7 @@ const textColor = 'rgb(0, 0, 0)'; const colorSet = getColorsWithSubjectColor(subjectColor, backColor); export default { - version: '0.7.8', + version: '0.7.9', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', diff --git a/packages/plugin/package.json b/packages/plugin/package.json index d53abc45446..c33cfb1c185 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-plugin", - "version": "0.7.8", + "version": "0.7.9", "description": "G6 Plugin", "main": "lib/index.js", "module": "es/index.js", @@ -22,8 +22,8 @@ "@antv/g-base": "^0.5.1", "@antv/g-canvas": "^0.5.2", "@antv/g-svg": "^0.5.2", - "@antv/g6-core": "0.7.8", - "@antv/g6-element": "0.7.8", + "@antv/g6-core": "0.7.9", + "@antv/g6-element": "0.7.9", "@antv/matrix-util": "^3.1.0-beta.3", "@antv/scale": "^0.3.4", "@antv/util": "^2.0.9", diff --git a/packages/site/package.json b/packages/site/package.json index 72dfe14fe7b..0831c13bbeb 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@antv/g6-site", - "version": "4.7.8", + "version": "4.7.9", "description": "G6 sites deployed on gh-pages", "keywords": [ "antv", @@ -36,7 +36,7 @@ "dependencies": { "@ant-design/icons": "^4.0.6", "@antv/chart-node-g6": "^0.0.3", - "@antv/g6": "4.7.8", + "@antv/g6": "4.7.9", "@antv/gatsby-theme-antv": "1.1.15", "@antv/util": "^2.0.9", "@antv/vis-predict-engine": "^0.1.1",