fix: treegraph updatelayout

This commit is contained in:
Yanyan-Wang 2020-01-16 20:50:01 +08:00 committed by Yanyan Wang
parent f304d8ae74
commit 0fd4cf3b16
2 changed files with 16 additions and 1 deletions

View File

@ -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": {

View File

@ -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