mirror of
https://gitee.com/antv/g6.git
synced 2024-12-02 19:58:46 +08:00
fix: treegraph updatelayout
This commit is contained in:
parent
f304d8ae74
commit
0fd4cf3b16
@ -50,7 +50,8 @@
|
||||
"test": "jest",
|
||||
"test-live": "DEBUG_MODE=1 jest --watch ./tests/unit/layout/dagre-spec.ts",
|
||||
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx",
|
||||
"watch": "father build -w"
|
||||
"watch": "father build -w",
|
||||
"cdn": "antv-bin upload -n @antv/g6"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -214,6 +214,20 @@ export default class TreeGraph extends Graph implements ITreeGraph {
|
||||
self.layout(this.get('fitView'));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更改并应用树布局算法
|
||||
* @param {object} layout 布局算法
|
||||
*/
|
||||
public updateLayout(layout) {
|
||||
const self = this;
|
||||
if (!layout) {
|
||||
console.warn('layout cannot be null');
|
||||
return;
|
||||
}
|
||||
self.set('layout', layout);
|
||||
self.set('layoutMethod', self.getLayout());
|
||||
self.layout();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据目前的 data 刷新布局,更新到画布上。用于变更数据之后刷新视图。
|
||||
|
Loading…
Reference in New Issue
Block a user