client/js/paper-renderer.js
changeset 193 7d95ace8c08f
parent 190 a9040a7c47d9
child 194 f53a7999ae7b
equal deleted inserted replaced
192:47aa37d3e750 193:7d95ace8c08f
   110         }
   110         }
   111     }
   111     }
   112 };
   112 };
   113 
   113 
   114 Rkns._(_BaseRepresentation.prototype).extend({
   114 Rkns._(_BaseRepresentation.prototype).extend({
   115     super: function(_func) {
   115     _super: function(_func) {
   116         _BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1));
   116         return _BaseRepresentation.prototype[_func].apply(this, Array.prototype.slice.call(arguments, 1));
   117     },
   117     },
   118     redraw: function() {},
   118     redraw: function() {},
   119     moveTo: function() {},
   119     moveTo: function() {},
   120     show: function() {},
   120     show: function() {},
   121     hide: function() {},
   121     hide: function() {},
   482     
   482     
   483     if (this.renderer.minimap) {
   483     if (this.renderer.minimap) {
   484         this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;
   484         this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;
   485         this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
   485         this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
   486     }
   486     }
   487     this.super("select");
   487     this._super("select");
   488 },
   488 },
   489 unselect: function(_newTarget) {
   489 unselect: function(_newTarget) {
   490     if (!_newTarget || _newTarget.source_representation !== this) {
   490     if (!_newTarget || _newTarget.source_representation !== this) {
   491         this.selected = false;
   491         this.selected = false;
   492         this.all_buttons.forEach(function(b) {
   492         this.all_buttons.forEach(function(b) {
   495         this.circle.strokeWidth = this.options.node_stroke_width;
   495         this.circle.strokeWidth = this.options.node_stroke_width;
   496         Rkns.$('.Rk-Bin-Item').removeClass("selected");
   496         Rkns.$('.Rk-Bin-Item').removeClass("selected");
   497         if (this.renderer.minimap) {
   497         if (this.renderer.minimap) {
   498             this.minimap_circle.strokeColor = undefined;
   498             this.minimap_circle.strokeColor = undefined;
   499         }
   499         }
   500         this.super("unselect");
   500         this._super("unselect");
   501     }
   501     }
   502 },
   502 },
   503 highlight: function() {
   503 highlight: function() {
   504     if (this.highlighted) {
   504     if (this.highlighted) {
   505         return;
   505         return;
   546     this.renderer.click_target = null;
   546     this.renderer.click_target = null;
   547     this.renderer.is_dragging = false;
   547     this.renderer.is_dragging = false;
   548     this.is_dragging = false;
   548     this.is_dragging = false;
   549 },
   549 },
   550 destroy: function(_event) {
   550 destroy: function(_event) {
   551     this.super("destroy");
   551     this._super("destroy");
   552     this.all_buttons.forEach(function(b) {
   552     this.all_buttons.forEach(function(b) {
   553         b.destroy();
   553         b.destroy();
   554     });
   554     });
   555     this.circle.remove();
   555     this.circle.remove();
   556     this.title.remove();
   556     this.title.remove();
   720         });
   720         });
   721     }
   721     }
   722     if (!this.options.editor_mode) {
   722     if (!this.options.editor_mode) {
   723         this.openEditor();
   723         this.openEditor();
   724     }
   724     }
   725     this.super("select");
   725     this._super("select");
   726 },
   726 },
   727 unselect: function(_newTarget) {
   727 unselect: function(_newTarget) {
   728     if (!_newTarget || _newTarget.source_representation !== this) {
   728     if (!_newTarget || _newTarget.source_representation !== this) {
   729         this.selected = false;
   729         this.selected = false;
   730         if (this.options.editor_mode) {
   730         if (this.options.editor_mode) {
   731             this.all_buttons.forEach(function(b) {
   731             this.all_buttons.forEach(function(b) {
   732                 b.hide();
   732                 b.hide();
   733             });
   733             });
   734         }
   734         }
   735         this.line.strokeWidth = this.options.edge_stroke_width;
   735         this.line.strokeWidth = this.options.edge_stroke_width;
   736         this.super("unselect");
   736         this._super("unselect");
   737     }
   737     }
   738 },
   738 },
   739 mousedown: function(_event, _isTouch) {
   739 mousedown: function(_event, _isTouch) {
   740     if (_isTouch) {
   740     if (_isTouch) {
   741         this.renderer.unselectAll();
   741         this.renderer.unselectAll();
   766     } else {
   766     } else {
   767         this.renderer.paperShift(_delta);
   767         this.renderer.paperShift(_delta);
   768     }
   768     }
   769 },
   769 },
   770 destroy: function() {
   770 destroy: function() {
   771     this.super("destroy");
   771     this._super("destroy");
   772     this.line.remove();
   772     this.line.remove();
   773     this.arrow.remove();
   773     this.arrow.remove();
   774     this.text.remove();
   774     this.text.remove();
   775     if (this.renderer.minimap) {
   775     if (this.renderer.minimap) {
   776         this.minimap_line.remove();
   776         this.minimap_line.remove();
  2486     if (this.click_mode === _CLICKMODE_ADDNODE) {
  2486     if (this.click_mode === _CLICKMODE_ADDNODE) {
  2487         this.click_mode = false;
  2487         this.click_mode = false;
  2488         this.notif_$.hide();
  2488         this.notif_$.hide();
  2489     } else {
  2489     } else {
  2490         this.click_mode = _CLICKMODE_ADDNODE;
  2490         this.click_mode = _CLICKMODE_ADDNODE;
  2491         this.notif_$.text(_renkan.translate("Click on the background canvas to add a node")).fadeIn();
  2491         this.notif_$.text(this.renkan.translate("Click on the background canvas to add a node")).fadeIn();
  2492     }
  2492     }
  2493     return false;
  2493     return false;
  2494 },
  2494 },
  2495 addEdgeBtn: function() {
  2495 addEdgeBtn: function() {
  2496     if (this.click_mode === _CLICKMODE_STARTEDGE || this.click_mode === _CLICKMODE_ENDEDGE) {
  2496     if (this.click_mode === _CLICKMODE_STARTEDGE || this.click_mode === _CLICKMODE_ENDEDGE) {
  2497         this.click_mode = false;
  2497         this.click_mode = false;
  2498         this.notif_$.hide();
  2498         this.notif_$.hide();
  2499     } else {
  2499     } else {
  2500         this.click_mode = _CLICKMODE_STARTEDGE;
  2500         this.click_mode = _CLICKMODE_STARTEDGE;
  2501         this.notif_$.text(_renkan.translate("Click on a first node to start the edge")).fadeIn();
  2501         this.notif_$.text(this.renkan.translate("Click on a first node to start the edge")).fadeIn();
  2502     }
  2502     }
  2503     return false;
  2503     return false;
  2504 },
  2504 },
  2505 foldBins: function() {
  2505 foldBins: function() {
  2506     var foldBinsButton = this.$.find(".Rk-Fold-Bins"),
  2506     var foldBinsButton = this.$.find(".Rk-Fold-Bins"),