From 142e9eaeb8812d2b4770243bd3999166e076cdb3 Mon Sep 17 00:00:00 2001 From: Yanyan Wang Date: Fri, 11 Nov 2022 17:06:45 +0800 Subject: [PATCH] fix: unexpected move with fitCenter with animation; fix: update modelRect with rendering error, closes: #4041; (#4042) --- CHANGELOG.md | 5 +++++ packages/core/package.json | 2 +- packages/core/src/element/shape.ts | 8 ++++---- packages/core/src/global.ts | 2 +- packages/core/src/graph/controller/view.ts | 1 - packages/element/package.json | 4 ++-- packages/element/src/nodes/modelRect.ts | 13 ++++++++++++- packages/g6/package.json | 4 ++-- packages/g6/src/index.ts | 4 ++-- packages/pc/package.json | 8 ++++---- packages/pc/src/global.ts | 2 +- packages/plugin/package.json | 6 +++--- packages/site/package.json | 4 ++-- 13 files changed, 39 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f52f95ae..af05662c9c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog +### 4.7.13 + +- fix: unexpected move with fitCenter with animation; +- fix: update modelRect with rendering error, closes: #4041; + ### 4.7.12 - fix: drag-canvas incorrectly stopped by right click; diff --git a/packages/core/package.json b/packages/core/package.json index 21c3a0d35d..6934bd6257 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-core", - "version": "0.7.12", + "version": "0.7.13", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", diff --git a/packages/core/src/element/shape.ts b/packages/core/src/element/shape.ts index fd3bc685d3..b8e83e470e 100644 --- a/packages/core/src/element/shape.ts +++ b/packages/core/src/element/shape.ts @@ -130,17 +130,17 @@ const ShapeFramework = { /** * 绘制 */ - drawShape(/* cfg, group */) {}, + drawShape(/* cfg, group */) { }, /** * 绘制完成后的操作,便于用户继承现有的节点、边 */ - afterDraw(/* cfg, group */) {}, + afterDraw(/* cfg, group */) { }, // update(cfg, item) // 默认不定义 - afterUpdate(/* cfg, item */) {}, + afterUpdate(/* cfg, item */) { }, /** * 设置节点、边状态 */ - setState(/* name, value, item */) {}, + setState(/* name, value, item */) { }, /** * 获取控制点 * @param {Object} cfg 节点、边的配置项 diff --git a/packages/core/src/global.ts b/packages/core/src/global.ts index 75253363fe..e2aa5b1517 100644 --- a/packages/core/src/global.ts +++ b/packages/core/src/global.ts @@ -64,7 +64,7 @@ const colorSet = { }; export default { - version: '0.7.12', + version: '0.7.13', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', diff --git a/packages/core/src/graph/controller/view.ts b/packages/core/src/graph/controller/view.ts index 37f58d72d8..0c3af24ec8 100644 --- a/packages/core/src/graph/controller/view.ts +++ b/packages/core/src/graph/controller/view.ts @@ -33,7 +33,6 @@ export default class ViewController { public fitCenter(animate?: boolean, animateCfg?: GraphAnimateConfig) { const { graph } = this; const group: IGroup = graph.get('group'); - group.resetMatrix(); const bbox = group.getCanvasBBox(); if (bbox.width === 0 || bbox.height === 0) return; const viewCenter = this.getViewCenter(); diff --git a/packages/element/package.json b/packages/element/package.json index e2faac0ae7..cbc9803a72 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-element", - "version": "0.7.12", + "version": "0.7.13", "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.12", + "@antv/g6-core": "0.7.13", "@antv/util": "~2.0.5" }, "devDependencies": { diff --git a/packages/element/src/nodes/modelRect.ts b/packages/element/src/nodes/modelRect.ts index cff5b0b6e1..6998f1b9f4 100644 --- a/packages/element/src/nodes/modelRect.ts +++ b/packages/element/src/nodes/modelRect.ts @@ -1,4 +1,4 @@ -import { mix, isString } from '@antv/util'; +import { mix, isString, deepMix } from '@antv/util'; import { IGroup, IShape } from '@antv/g-base'; import { registerNode, @@ -7,6 +7,7 @@ import { ShapeStyle, ShapeOptions, BaseGlobal as Global, + UpdateType, } from '@antv/g6-core'; registerNode( @@ -531,6 +532,16 @@ registerNode( (this as any).updateLinkPoints(cfg, group); }, + getOptions(cfg: NodeConfig, updateType?: UpdateType): NodeConfig { + if (updateType === 'move') return cfg; + // different from baseShape, the config should be mixed when the updateType is not 'move' + return deepMix( + {}, + this.options, + this.getCustomConfig(cfg) || {}, + cfg, + ); + }, }, 'single-node', ); diff --git a/packages/g6/package.json b/packages/g6/package.json index 42b131decc..9a785c172a 100644 --- a/packages/g6/package.json +++ b/packages/g6/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6", - "version": "4.7.12", + "version": "4.7.13", "description": "A Graph Visualization Framework in JavaScript", "keywords": [ "antv", @@ -66,7 +66,7 @@ ] }, "dependencies": { - "@antv/g6-pc": "0.7.12" + "@antv/g6-pc": "0.7.13" }, "devDependencies": { "@babel/core": "^7.7.7", diff --git a/packages/g6/src/index.ts b/packages/g6/src/index.ts index 4139a3278f..9eeab4f51b 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.12'; +G6.version = '4.7.13'; export * from '@antv/g6-pc'; export default G6; -export const version = '4.7.12'; +export const version = '4.7.13'; diff --git a/packages/pc/package.json b/packages/pc/package.json index b999fe0335..2bd634a215 100644 --- a/packages/pc/package.json +++ b/packages/pc/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-pc", - "version": "0.7.12", + "version": "0.7.13", "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.12", - "@antv/g6-element": "0.7.12", - "@antv/g6-plugin": "0.7.12", + "@antv/g6-core": "0.7.13", + "@antv/g6-element": "0.7.13", + "@antv/g6-plugin": "0.7.13", "@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 fae09f0f02..e53c747101 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.12', + version: '0.7.13', rootContainerClassName: 'root-container', nodeContainerClassName: 'node-container', edgeContainerClassName: 'edge-container', diff --git a/packages/plugin/package.json b/packages/plugin/package.json index 5a3d1efc67..6e76d8b3d3 100644 --- a/packages/plugin/package.json +++ b/packages/plugin/package.json @@ -1,6 +1,6 @@ { "name": "@antv/g6-plugin", - "version": "0.7.12", + "version": "0.7.13", "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.12", - "@antv/g6-element": "0.7.12", + "@antv/g6-core": "0.7.13", + "@antv/g6-element": "0.7.13", "@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 dedc450e9a..ce2454e41a 100644 --- a/packages/site/package.json +++ b/packages/site/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "@antv/g6-site", - "version": "4.7.12", + "version": "4.7.13", "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.12", + "@antv/g6": "4.7.13", "@antv/gatsby-theme-antv": "1.1.15", "@antv/util": "^2.0.9", "@antv/vis-predict-engine": "^0.1.1",