diff -r 0d5998b32a7c -r e529b633c339 client/js/renderer/noderepr.js --- a/client/js/renderer/noderepr.js Sat Apr 25 04:37:06 2015 +0200 +++ b/client/js/renderer/noderepr.js Mon Apr 27 17:22:46 2015 +0200 @@ -56,8 +56,7 @@ } }, buildShape: function(){ - if(typeof this.model.get("shape_changed")!=="undefined" && this.model.get("shape_changed")===true){ - this.model.set("shape_changed", false); + if( 'shape' in this.model.changed ) { delete this.img; } if(this.circle){ @@ -68,14 +67,16 @@ this.shapeBuilder = new ShapeBuilder(this.model.get("shape")); this.circle = this.shapeBuilder.getShape(); this.circle.__representation = this; + this.circle.sendToBack(); this.last_circle_radius = 1; }, - redraw: function(_dontRedrawEdges) { - if(typeof this.model.get("shape_changed")!=="undefined" && this.model.get("shape_changed")===true){ + redraw: function(options) { + if( 'shape' in this.model.changed && 'change' in options && options.change ) { + //if( 'shape' in this.model.changed ) { this.buildShape(); } var _model_coords = new paper.Point(this.model.get("position")), - _baseRadius = this.options.node_size_base * Math.exp((this.model.get("size") || 0) * Utils._NODE_SIZE_STEP); + _baseRadius = this.options.node_size_base * Math.exp((this.model.get("size") || 0) * Utils._NODE_SIZE_STEP); if (!this.is_dragging || !this.paper_coords) { this.paper_coords = this.renderer.toPaperCoords(_model_coords); } @@ -151,6 +152,9 @@ this.img = this.model.get("image"); if (this.img && this.img !== lastImage) { this.showImage(); + if(this.circle) { + this.circle.sendToBack(); + } } if (this.node_image && !this.img) { this.node_image.remove(); @@ -165,7 +169,7 @@ this.minimap_circle.fitBounds(minipos.subtract(minisize), minisize.multiply(2)); } - if (!_dontRedrawEdges) { + if (typeof options === 'undefined' || !('dontRedrawEdges' in options) || !options.dontRedrawEdges) { var _this = this; _.each( this.project.get("edges").filter( @@ -304,8 +308,7 @@ this.node_image.__representation = _this; this.node_image.scale(this.circle_radius / baseRadius); this.node_image.position = this.paper_coords.subtract(this.image_delta.multiply(this.circle_radius)); - this.redraw(); - this.renderer.throttledPaperDraw(); + this.node_image.insertAbove(this.circle); } else { var _this = this; $(_image).on("load", function() {