client/js/renderer/noderepr.js
changeset 396 b51c25ef4292
parent 331 0628ed75e8d3
child 403 96781c1a8bbe
equal deleted inserted replaced
395:2e8c92eb0dfa 396:b51c25ef4292
    22                 this.h_ratio = 1;
    22                 this.h_ratio = 1;
    23             } else {
    23             } else {
    24                 this.h_ratio = 0;
    24                 this.h_ratio = 0;
    25             }
    25             }
    26             this.title = $('<div class="Rk-Label">').appendTo(this.renderer.labels_$);
    26             this.title = $('<div class="Rk-Label">').appendTo(this.renderer.labels_$);
    27             
    27 
    28             if (this.options.editor_mode) {
    28             if (this.options.editor_mode) {
    29                 var Renderer = requtils.getRenderer();
    29                 var Renderer = requtils.getRenderer();
    30                 this.normal_buttons = [
    30                 this.normal_buttons = [
    31                                        new Renderer.NodeEditButton(this.renderer, null),
    31                                        new Renderer.NodeEditButton(this.renderer, null),
    32                                        new Renderer.NodeRemoveButton(this.renderer, null),
    32                                        new Renderer.NodeRemoveButton(this.renderer, null),
    36                                        ];
    36                                        ];
    37                 this.pending_delete_buttons = [
    37                 this.pending_delete_buttons = [
    38                                                new Renderer.NodeRevertButton(this.renderer, null)
    38                                                new Renderer.NodeRevertButton(this.renderer, null)
    39                                                ];
    39                                                ];
    40                 this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);
    40                 this.all_buttons = this.normal_buttons.concat(this.pending_delete_buttons);
    41                 
    41 
    42                 for (var i = 0; i < this.all_buttons.length; i++) {
    42                 for (var i = 0; i < this.all_buttons.length; i++) {
    43                     this.all_buttons[i].source_representation = this;
    43                     this.all_buttons[i].source_representation = this;
    44                 }
    44                 }
    45                 this.active_buttons = [];
    45                 this.active_buttons = [];
    46             } else {
    46             } else {
   202                 clipPath = this.model.get("clip_path"),
   202                 clipPath = this.model.get("clip_path"),
   203                 hasClipPath = (typeof clipPath !== "undefined" && clipPath),
   203                 hasClipPath = (typeof clipPath !== "undefined" && clipPath),
   204                 _clip = null,
   204                 _clip = null,
   205                 baseRadius = null,
   205                 baseRadius = null,
   206                 centerPoint = null;
   206                 centerPoint = null;
   207                 
   207 
   208                 if (hasClipPath) {
   208                 if (hasClipPath) {
   209                     _clip = new paper.Path();
   209                     _clip = new paper.Path();
   210                     var instructions = clipPath.match(/[a-z][^a-z]+/gi) || [],
   210                     var instructions = clipPath.match(/[a-z][^a-z]+/gi) || [],
   211                     lastCoords = [0,0],
   211                     lastCoords = [0,0],
   212                     minX = Infinity,
   212                     minX = Infinity,
   355                 this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;
   355                 this.minimap_circle.strokeWidth = this.options.minimap_highlight_weight;
   356                 this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
   356                 this.minimap_circle.strokeColor = this.options.minimap_highlight_color;
   357             }
   357             }
   358             this._super("select");
   358             this._super("select");
   359         },
   359         },
       
   360         hideButtons: function() {
       
   361             this.all_buttons.forEach(function(b) {
       
   362                 b.hide();
       
   363             });
       
   364             delete(this.buttonTimeout);
       
   365         },
   360         unselect: function(_newTarget) {
   366         unselect: function(_newTarget) {
   361             if (!_newTarget || _newTarget.source_representation !== this) {
   367             if (!_newTarget || _newTarget.source_representation !== this) {
   362                 this.selected = false;
   368                 this.selected = false;
   363                 this.all_buttons.forEach(function(b) {
   369                 var _this = this;
   364                     b.hide();
   370                 this.buttons_timeout = setTimeout(function() { _this.hideButtons(); }, 200);
   365                 });
       
   366                 this.circle.strokeWidth = this.options.node_stroke_width;
   371                 this.circle.strokeWidth = this.options.node_stroke_width;
   367                 $('.Rk-Bin-Item').removeClass("selected");
   372                 $('.Rk-Bin-Item').removeClass("selected");
   368                 if (this.renderer.minimap) {
   373                 if (this.renderer.minimap) {
   369                     this.minimap_circle.strokeColor = undefined;
   374                     this.minimap_circle.strokeColor = undefined;
   370                 }
   375                 }