client/js/renderer/noderepr.js
changeset 600 e12243191095
parent 533 b7725d8f094d
child 649 2b9c120dba55
equal deleted inserted replaced
599:79c59e503f08 600:e12243191095
   141 
   141 
   142             this.circle.fillColor = this.highlighted ? this.options.highlighted_node_fill_color : this.options.node_fill_color;
   142             this.circle.fillColor = this.highlighted ? this.options.highlighted_node_fill_color : this.options.node_fill_color;
   143 
   143 
   144             this.circle.opacity = this.options.show_node_circles ? opacity : 0.01;
   144             this.circle.opacity = this.options.show_node_circles ? opacity : 0.01;
   145 
   145 
   146             
   146 
   147             //strip html from title
   147             //strip html from title
   148             var html = this.model.get("title");
   148             var html = this.model.get("title");
   149             var div = document.createElement("div");
   149             var div = document.createElement("div");
   150             div.innerHTML = html;
   150             div.innerHTML = html;
   151             var clean_title = div.textContent || div.innerText || "";
   151             var clean_title = div.textContent || div.innerText || "";
   152             
   152 
   153             var _text = clean_title || this.renkan.translate(this.options.label_untitled_nodes) || "";
   153             var _text = clean_title || this.renkan.translate(this.options.label_untitled_nodes) || "";
   154             _text = Utils.shortenText(_text, this.options.node_label_max_length);
   154             _text = Utils.shortenText(_text, this.options.node_label_max_length);
   155 
   155 
   156             if (typeof this.highlighted === "object") {
   156             if (typeof this.highlighted === "object") {
   157                 this.title.html(this.highlighted.replace(_(_text).escape(),'<span class="Rk-Highlighted">$1</span>'));
   157                 this.title.html(this.highlighted.replace(_(_text).escape(),'<span class="Rk-Highlighted">$1</span>'));
   224                 this.renderer.image_cache[this.img] = _image;
   224                 this.renderer.image_cache[this.img] = _image;
   225                 _image.src = this.img;
   225                 _image.src = this.img;
   226             } else {
   226             } else {
   227                 _image = this.renderer.image_cache[this.img];
   227                 _image = this.renderer.image_cache[this.img];
   228             }
   228             }
       
   229             var _this = this;
   229             if (_image.width) {
   230             if (_image.width) {
       
   231 
   230                 if (this.node_image) {
   232                 if (this.node_image) {
   231                     this.node_image.remove();
   233                     this.node_image.remove();
   232                 }
   234                 }
   233                 this.renderer.node_layer.activate();
   235                 this.renderer.node_layer.activate();
   234                 var width = _image.width,
   236                 var width = _image.width,
   338                 this.node_image.__representation = _this;
   340                 this.node_image.__representation = _this;
   339                 this.node_image.scale(this.circle_radius / baseRadius);
   341                 this.node_image.scale(this.circle_radius / baseRadius);
   340                 this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));
   342                 this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius));
   341                 this.node_image.insertAbove(this.circle);
   343                 this.node_image.insertAbove(this.circle);
   342             } else {
   344             } else {
   343                 var _this = this;
       
   344                 $(_image).on("load", function() {
   345                 $(_image).on("load", function() {
   345                     _this.showImage();
   346                     _this.showImage();
   346                 });
   347                 });
   347             }
   348             }
   348         },
   349         },
   468                 }
   469                 }
   469                 this.circle.opacity = this.options.ghost_opacity;
   470                 this.circle.opacity = this.options.ghost_opacity;
   470                 this.title.css('opacity', this.options.ghost_opacity);
   471                 this.title.css('opacity', this.options.ghost_opacity);
   471                 this.minimap_circle.opacity = this.options.ghost_opacity;
   472                 this.minimap_circle.opacity = this.options.ghost_opacity;
   472             } else {
   473             } else {
   473                 this.minimap_circle.opacity = 1; 
   474                 this.minimap_circle.opacity = 1;
   474                 this.hidden = false;
   475                 this.hidden = false;
   475                 this.redraw();
   476                 this.redraw();
   476             }
   477             }
   477 
   478 
   478             _.each(
   479             _.each(