mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-12-22 19:33:48 +01:00
hidding relationship line when colapsing nodes
This commit is contained in:
parent
2430db31b3
commit
a6c066273b
@ -589,6 +589,7 @@ mindplot.MindmapDesigner.prototype._relationshipModelToRelationship = function(m
|
||||
sourceTopic.addRelationship(relationship);
|
||||
var targetTopic = relationship.getTargetTopic();
|
||||
targetTopic.addRelationship(relationship);
|
||||
relationship.setVisibility(sourceTopic.isVisible() && targetTopic.isVisible());
|
||||
var workspace = this._workspace;
|
||||
workspace.appendChild(relationship);
|
||||
relationship.redraw();
|
||||
@ -1420,3 +1421,14 @@ mindplot.MindmapDesigner.prototype.getWorkSpace = function()
|
||||
{
|
||||
return this._workspace;
|
||||
};
|
||||
|
||||
mindplot.MindmapDesigner.prototype.findRelationShipsByTopicId = function(topicId){
|
||||
var result = [];
|
||||
for(var relationshipId in this._relationships){
|
||||
var relationship = this._relationships[relationshipId];
|
||||
if(relationship.getModel().getFromNode()==topicId || relationship.getModel().getToNode()==topicId){
|
||||
result.push(relationship);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
@ -989,6 +989,20 @@ mindplot.Topic.prototype.setVisibility = function(value)
|
||||
|
||||
// Hide all children...
|
||||
this._setChildrenVisibility(value);
|
||||
|
||||
this._setRelationshipLinesVisibility(value);
|
||||
};
|
||||
|
||||
mindplot.Topic.prototype.isVisible = function(){
|
||||
var elem = this.get2DElement();
|
||||
return elem.isVisible();
|
||||
};
|
||||
|
||||
mindplot.Topic.prototype._setRelationshipLinesVisibility = function(value){
|
||||
var relationships = designer.findRelationShipsByTopicId(this.getId());
|
||||
relationships.forEach(function(relationship, index){
|
||||
relationship.setVisibility(value);
|
||||
});
|
||||
};
|
||||
|
||||
mindplot.Topic.prototype._setTopicVisibility = function(value)
|
||||
@ -1018,9 +1032,7 @@ mindplot.Topic.prototype._setChildrenVisibility = function(isVisible)
|
||||
for (var i = 0; i < children.length; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
child._setChildrenVisibility(isVisible);
|
||||
|
||||
child._setTopicVisibility(isVisible);
|
||||
child.setVisibility(isVisible);
|
||||
|
||||
var outgoingLine = child.getOutgoingLine();
|
||||
outgoingLine.setVisibility(isVisible);
|
||||
|
Loading…
Reference in New Issue
Block a user