feat: layout export group.Closes #355

This commit is contained in:
TomHuangCN 2018-07-09 15:05:36 +08:00
parent 41b6a1c723
commit 865851df72
2 changed files with 10 additions and 2 deletions

View File

@ -71,7 +71,14 @@ class Controller extends Base {
.map(edge => {
return edge.getModel();
});
graph._executeLayout(processer, nodes, edges);
const groups = graph.getGroups()
.filter(group => {
return group.isVisible();
})
.map(group => {
return group.getModel();
});
graph._executeLayout(processer, nodes, edges, groups);
graph.updateNodePosition();
graph.emit('afterlayout');
}

View File

@ -138,12 +138,13 @@ class Graph extends Base {
initEvent() {
}
_executeLayout(processer, nodes, edges) {
_executeLayout(processer, nodes, edges, groups) {
if (Util.isFunction(processer)) {
processer(nodes, edges, this);
} else if (Util.isObject(processer)) {
processer.nodes = nodes;
processer.edges = edges;
processer.groups = groups;
processer.graph = this;
processer.execute();
}