This commit is contained in:
huangtong.ht 2018-07-27 08:22:57 +08:00
parent 1badd28554
commit 94f468a5ba
4 changed files with 24 additions and 14 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@antv/g6",
"version": "2.0.5-beta.4",
"version": "2.0.5-beta.5",
"description": "graph visualization frame work",
"main": "build/g6.js",
"homepage": "https://github.com/antvis/g6",

View File

@ -695,9 +695,9 @@ class Graph extends Base {
item.getEdges().forEach(edge => {
edge.hide();
});
item.getInnerEdges().forEach(edge => {
edge.hide();
});
// item.getInnerEdges().forEach(edge => {
// edge.hide();
// });
item.deepEach(child => {
child.hide();
});
@ -705,6 +705,13 @@ class Graph extends Base {
this.draw();
return this;
}
_tryShowEdge(edge) {
const source = edge.getSource();
const target = edge.getTarget();
return (source.linkable && source.isVisible() || !source.linkable)
&& (target.linkable && target.isVisible() || !target.linkable)
&& edge.show();
}
/**
* show item
* @param {number} item input item
@ -713,24 +720,22 @@ class Graph extends Base {
show(item) {
item = this.getItem(item);
if (item.isEdge) {
item.getSource().isVisible() && item.getTarget().isVisible() && item.show();
this._tryShowEdge(item);
} else {
item.show();
}
if (item.isNode) {
item.getEdges().forEach(edge => {
const source = edge.getSource();
const target = edge.getTarget();
source.isVisible() && target.isVisible() && edge.show();
this._tryShowEdge(edge);
});
}
if (item.isGroup) {
item.getEdges().forEach(edge => {
edge.show();
});
item.getInnerEdges().forEach(edge => {
edge.show();
this._tryShowEdge(edge);
});
// item.getInnerEdges().forEach(edge => {
// edge.show();
// });
item.deepEach(child => {
child.show();
});

View File

@ -257,7 +257,12 @@ class Tree extends Graph {
const newParent = this.find(model.parent);
const newParentModel = newParent.getModel();
Util.Array.remove(originParentModel.children, itemModel);
newParentModel.push(itemModel);
if (newParentModel.children) {
newParentModel.children.push(itemModel);
} else {
newParentModel.children = [ itemModel ];
}
this.find(newParentModel.id).forceUpdate();
}

View File

@ -1 +1 @@
module.exports = '2.0.5-beta.4';
module.exports = '2.0.5-beta.5';