From aab80cdc9c232c4ac7d6237f9351081560c496d5 Mon Sep 17 00:00:00 2001 From: Yanyan Wang Date: Sun, 23 Apr 2023 11:43:08 +0800 Subject: [PATCH] fix: update layout from animate false to true; (#4453) * fix: update layout from animate false to true; * chore: update version nums --- CHANGELOG.md | 4 ++++ packages/core/package.json | 2 +- packages/core/src/global.ts | 2 +- packages/element/package.json | 4 ++-- packages/g6/package.json | 4 ++-- packages/g6/src/index.ts | 4 ++-- packages/pc/package.json | 6 +++--- packages/pc/src/global.ts | 2 +- packages/pc/src/graph/controller/layout.ts | 10 ++++++++++ packages/plugin/package.json | 6 +++--- 10 files changed, 29 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 264c889e7dd..93926a4c084 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +### 4.8.10 + +- fix: update layout from animate false to true; + ### 4.8.9 - fix: type for draw function in elements, closes: #4395; diff --git a/packages/core/package.json b/packages/core/package.json index a8ae3a3967f..bfd9b2ca6ae 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-core", - "version": "0.8.9", + "version": "0.8.10", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", diff --git a/packages/core/src/global.ts b/packages/core/src/global.ts index 19514ada1c0..e93eafa051c 100644 --- a/packages/core/src/global.ts +++ b/packages/core/src/global.ts @@ -64,7 +64,7 @@ const colorSet = { }; export default { - version: '0.8.9', + version: '0.8.10', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', diff --git a/packages/element/package.json b/packages/element/package.json index a572d631d1f..09fa567cc6e 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-element", - "version": "0.8.9", + "version": "0.8.10", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -61,7 +61,7 @@ }, "dependencies": { "@antv/g-base": "^0.5.1", - "@antv/g6-core": "0.8.9", + "@antv/g6-core": "0.8.10", "@antv/util": "~2.0.5" }, "devDependencies": { diff --git a/packages/g6/package.json b/packages/g6/package.json index fb2a5a481e3..f6842bf5912 100644 --- a/packages/g6/package.json +++ b/packages/g6/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6", - "version": "4.8.9", + "version": "4.8.10", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -66,7 +66,7 @@ ] }, "dependencies": { - "@antv/g6-pc": "0.8.9" + "@antv/g6-pc": "0.8.10" }, "devDependencies": { "@babel/core": "^7.7.7", diff --git a/packages/g6/src/index.ts b/packages/g6/src/index.ts index 23c7b46c577..aa855666eab 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.8.9'; +G6.version = '4.8.10'; export * from '@antv/g6-pc'; export default G6; -export const version = '4.8.9'; +export const version = '4.8.10'; diff --git a/packages/pc/package.json b/packages/pc/package.json index 7d0c4bf3939..ac09c0e08a2 100644 --- a/packages/pc/package.json +++ b/packages/pc/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-pc", - "version": "0.8.9", + "version": "0.8.10", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -75,8 +75,8 @@ "@antv/g-canvas": "^0.5.2", "@antv/g-math": "^0.1.1", "@antv/g-svg": "^0.5.1", - "@antv/g6-core": "0.8.9", - "@antv/g6-element": "0.8.9", + "@antv/g6-core": "0.8.10", + "@antv/g6-element": "0.8.10", "@antv/g6-plugin": "^0.8.7", "@antv/hierarchy": "^0.6.10", "@antv/layout": "^0.3.0", diff --git a/packages/pc/src/global.ts b/packages/pc/src/global.ts index 6e347255f41..66076d3c459 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.8.9', + version: '0.8.10', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', diff --git a/packages/pc/src/graph/controller/layout.ts b/packages/pc/src/graph/controller/layout.ts index 9ffc3cb015f..d04d5c284a0 100644 --- a/packages/pc/src/graph/controller/layout.ts +++ b/packages/pc/src/graph/controller/layout.ts @@ -191,6 +191,16 @@ export default class LayoutController extends AbstractLayout { reslove(); } + if (Util.isForce(layoutType)) { + const { onTick, animate } = layoutCfg; + const isDefaultAnimateLayout = animate === undefined && (layoutType === 'force' || layoutType === 'force2'); + const tick = () => { + onTick?.(); + if (animate || isDefaultAnimateLayout) graph.refreshPositions(); + }; + layoutCfg.tick = tick; + } + const layoutData = this.filterLayoutData(this.data, layoutCfg); layoutMethod.init(layoutData); layoutMethod.updateCfg(layoutCfg); diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 365ee47de09..d682ac37c77 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-plugin", - "version": "0.8.9", + "version": "0.8.10", "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.8.9", - "@antv/g6-element": "0.8.9", + "@antv/g6-core": "0.8.10", + "@antv/g6-element": "0.8.10", "@antv/matrix-util": "^3.1.0-beta.3", "@antv/scale": "^0.3.4", "@antv/util": "^2.0.9",