--- a/client/js/renderer/noderepr.js Fri May 22 17:45:50 2015 +0200
+++ b/client/js/renderer/noderepr.js Fri May 22 17:48:18 2015 +0200
@@ -33,6 +33,7 @@
new Renderer.NodeEditButton(this.renderer, null),
new Renderer.NodeRemoveButton(this.renderer, null),
new Renderer.NodeHideButton(this.renderer, null),
+ new Renderer.NodeShowButton(this.renderer, null),
new Renderer.NodeLinkButton(this.renderer, null),
new Renderer.NodeEnlargeButton(this.renderer, null),
new Renderer.NodeShrinkButton(this.renderer, null)
@@ -367,6 +368,8 @@
//if the node is hidden and the mouse hover it, it appears as a ghost
if (this.hidden){
this.show(true);
+ }else{
+ this.showNeighbors(true);
}
this._super("select");
},
@@ -389,6 +392,8 @@
//when the mouse don't hover the node anymore, we hide it
if (this.hidden){
this.hide();
+ }else{
+ this.hideNeighbors();
}
this._super("unselect");
}
@@ -419,6 +424,7 @@
}
}
);
+ this.hideNeighbors();
},
show: function(ghost){
var _this = this;
@@ -449,6 +455,44 @@
}
);
},
+ hideNeighbors: function(){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.ghost) {
+ repr.hide();
+ }
+ }
+ );
+ },
+ showNeighbors: function(ghost){
+ var _this = this;
+ _.each(
+ this.project.get("edges").filter(
+ function (ed) {
+ return (ed.get("from") === _this.model);
+ }
+ ),
+ function(edge, index, list) {
+ var repr = _this.renderer.getRepresentationByModel(edge.get("to"));
+ if (repr && repr.hidden) {
+ repr.show(ghost);
+ if (!ghost){
+ var indexNode = _this.renderer.hiddenNodes.indexOf(repr.model.id);
+ if (indexNode !== -1){
+ _this.renderer.hiddenNodes.splice(indexNode, 1);
+ }
+ }
+ }
+ }
+ );
+ },
highlight: function(textToReplace) {
var hlvalue = textToReplace || true;
if (this.highlighted === hlvalue) {