equal
deleted
inserted
replaced
317 } |
317 } |
318 |
318 |
319 if (!_dontRedrawEdges) { |
319 if (!_dontRedrawEdges) { |
320 Rkns._.each(this.project.get("edges").filter(function (ed) { return ((ed.to === this.model) || (ed.from === this.model));}), function(edge, index, list){ |
320 Rkns._.each(this.project.get("edges").filter(function (ed) { return ((ed.to === this.model) || (ed.from === this.model));}), function(edge, index, list){ |
321 var repr = this.renderer.getRepresentationByModel(edge); |
321 var repr = this.renderer.getRepresentationByModel(edge); |
322 if(repr != null && typeof repr.from_representation.paper_coords !== "undefined" && typeof repr.to_representation.paper_coords !== "undefined") { |
322 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") { |
323 repr.redraw(); |
323 repr.redraw(); |
324 } |
324 } |
325 }, this); |
325 }, this); |
326 } |
326 } |
327 |
327 |
328 }; |
328 }; |
329 |
329 |
330 Rkns.Renderer.Node.prototype.showImage = function() { |
330 Rkns.Renderer.Node.prototype.showImage = function() { |
331 if (typeof this.renderer.image_cache[this.img] === "undefined") { |
331 if (typeof this.renderer.image_cache[this.img] === "undefined") { |
332 var _image = new Image() |
332 var _image = new Image(); |
333 this.renderer.image_cache[this.img] = _image; |
333 this.renderer.image_cache[this.img] = _image; |
334 _image.src = this.img; |
334 _image.src = this.img; |
335 } else { |
335 } else { |
336 var _image = this.renderer.image_cache[this.img]; |
336 var _image = this.renderer.image_cache[this.img]; |
337 } |
337 } |
628 |
628 |
629 Rkns.Renderer.Edge.prototype.redraw = function() { |
629 Rkns.Renderer.Edge.prototype.redraw = function() { |
630 this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from")); |
630 this.from_representation = this.renderer.getRepresentationByModel(this.model.get("from")); |
631 this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to")); |
631 this.to_representation = this.renderer.getRepresentationByModel(this.model.get("to")); |
632 if (!this.from_representation || !this.to_representation) { |
632 if (!this.from_representation || !this.to_representation) { |
|
633 /* |
|
634 console.log( |
|
635 "Error on edge " + this.model.get("id") |
|
636 + " from " + (this.model.get("from") ? this.model.get("from").get("id") : "<null>") |
|
637 + " to " + (this.model.get("to") ? this.model.get("to").get("id") : "<null>") |
|
638 ); |
|
639 */ |
633 return; |
640 return; |
634 } |
641 } |
635 var _p0a = this.from_representation.paper_coords, |
642 var _p0a = this.from_representation.paper_coords, |
636 _p1a = this.to_representation.paper_coords, |
643 _p1a = this.to_representation.paper_coords, |
637 _v = _p1a.subtract(_p0a), |
644 _v = _p1a.subtract(_p0a), |