mirror of
https://gitee.com/antv/g6.git
synced 2024-12-02 19:58:46 +08:00
fix show
This commit is contained in:
parent
1badd28554
commit
94f468a5ba
@ -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",
|
||||
|
27
src/graph.js
27
src/graph.js
@ -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();
|
||||
});
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -1 +1 @@
|
||||
module.exports = '2.0.5-beta.4';
|
||||
module.exports = '2.0.5-beta.5';
|
||||
|
Loading…
Reference in New Issue
Block a user