31 var Renderer = requtils.getRenderer(); |
31 var Renderer = requtils.getRenderer(); |
32 this.normal_buttons = [ |
32 this.normal_buttons = [ |
33 new Renderer.NodeEditButton(this.renderer, null), |
33 new Renderer.NodeEditButton(this.renderer, null), |
34 new Renderer.NodeRemoveButton(this.renderer, null), |
34 new Renderer.NodeRemoveButton(this.renderer, null), |
35 new Renderer.NodeHideButton(this.renderer, null), |
35 new Renderer.NodeHideButton(this.renderer, null), |
|
36 new Renderer.NodeShowButton(this.renderer, null), |
36 new Renderer.NodeLinkButton(this.renderer, null), |
37 new Renderer.NodeLinkButton(this.renderer, null), |
37 new Renderer.NodeEnlargeButton(this.renderer, null), |
38 new Renderer.NodeEnlargeButton(this.renderer, null), |
38 new Renderer.NodeShrinkButton(this.renderer, null) |
39 new Renderer.NodeShrinkButton(this.renderer, null) |
39 ]; |
40 ]; |
40 this.pending_delete_buttons = [ |
41 this.pending_delete_buttons = [ |
365 this.minimap_circle.strokeColor = this.options.minimap_highlight_color; |
366 this.minimap_circle.strokeColor = this.options.minimap_highlight_color; |
366 } |
367 } |
367 //if the node is hidden and the mouse hover it, it appears as a ghost |
368 //if the node is hidden and the mouse hover it, it appears as a ghost |
368 if (this.hidden){ |
369 if (this.hidden){ |
369 this.show(true); |
370 this.show(true); |
|
371 }else{ |
|
372 this.showNeighbors(true); |
370 } |
373 } |
371 this._super("select"); |
374 this._super("select"); |
372 }, |
375 }, |
373 hideButtons: function() { |
376 hideButtons: function() { |
374 this.all_buttons.forEach(function(b) { |
377 this.all_buttons.forEach(function(b) { |
446 if (repr && typeof repr.from_representation !== "undefined" && typeof repr.from_representation.paper_coords !== "undefined" && typeof repr.to_representation !== "undefined" && typeof repr.to_representation.paper_coords !== "undefined") { |
452 if (repr && typeof repr.from_representation !== "undefined" && typeof repr.from_representation.paper_coords !== "undefined" && typeof repr.to_representation !== "undefined" && typeof repr.to_representation.paper_coords !== "undefined") { |
447 repr.show(_this.ghost); |
453 repr.show(_this.ghost); |
448 } |
454 } |
449 } |
455 } |
450 ); |
456 ); |
|
457 }, |
|
458 hideNeighbors: function(){ |
|
459 var _this = this; |
|
460 _.each( |
|
461 this.project.get("edges").filter( |
|
462 function (ed) { |
|
463 return (ed.get("from") === _this.model); |
|
464 } |
|
465 ), |
|
466 function(edge, index, list) { |
|
467 var repr = _this.renderer.getRepresentationByModel(edge.get("to")); |
|
468 if (repr && repr.ghost) { |
|
469 repr.hide(); |
|
470 } |
|
471 } |
|
472 ); |
|
473 }, |
|
474 showNeighbors: function(ghost){ |
|
475 var _this = this; |
|
476 _.each( |
|
477 this.project.get("edges").filter( |
|
478 function (ed) { |
|
479 return (ed.get("from") === _this.model); |
|
480 } |
|
481 ), |
|
482 function(edge, index, list) { |
|
483 var repr = _this.renderer.getRepresentationByModel(edge.get("to")); |
|
484 if (repr && repr.hidden) { |
|
485 repr.show(ghost); |
|
486 if (!ghost){ |
|
487 var indexNode = _this.renderer.hiddenNodes.indexOf(repr.model.id); |
|
488 if (indexNode !== -1){ |
|
489 _this.renderer.hiddenNodes.splice(indexNode, 1); |
|
490 } |
|
491 } |
|
492 } |
|
493 } |
|
494 ); |
451 }, |
495 }, |
452 highlight: function(textToReplace) { |
496 highlight: function(textToReplace) { |
453 var hlvalue = textToReplace || true; |
497 var hlvalue = textToReplace || true; |
454 if (this.highlighted === hlvalue) { |
498 if (this.highlighted === hlvalue) { |
455 return; |
499 return; |