diff -r 2e8c92eb0dfa -r b51c25ef4292 client/js/renderer/scene.js --- a/client/js/renderer/scene.js Wed Mar 04 09:39:11 2015 +0100 +++ b/client/js/renderer/scene.js Fri Mar 13 10:56:19 2015 +0100 @@ -29,7 +29,7 @@ this.buttons_layer = new paper.Layer(); this.delete_list = []; this.redrawActive = true; - + var currentWidth = this.canvas_$.width(); var currentHeight = this.canvas_$.height(); @@ -279,34 +279,34 @@ bindClick(".Rk-Fold-Bins", "foldBins"); paper.view.onResize = function(_event) { - var _ratio, - newWidth= _this.canvas_$.parent().width(), - newHeight = _this.canvas_$.parent().height(); - + var _ratio, + newWidth= _this.canvas_$.parent().width(), + newHeight = _this.canvas_$.parent().height(); // Because of paper bug which does not calculate the good height and width - // We have to update manually the canvas's height and width + // We have to update manually the canvas's height and width + paper.view._viewSize.height = _event.size.height = _this.canvas_$.parent().height(); paper.view._viewSize.width = _event.size.height = _this.canvas_$.parent().width(); - + if (_this.minimap) { _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size); _this.minimap.rectangle.fitBounds(_this.minimap.topleft.subtract([2,2]), _this.minimap.size.add([4,4])); _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size); } - + if (newHeight < newWidth) { - _ratio = (newHeight/currentHeight); + _ratio = (newHeight/currentHeight); } else { - _ratio = (newWidth/currentWidth); + _ratio = (newWidth/currentWidth); } - - _this.resizeZoom((newWidth/currentWidth), (newHeight/currentHeight), _ratio); - - currentWidth = newWidth; - currentHeight = newHeight; - - _this.redraw(); - + + _this.resizeZoom((newWidth/currentWidth), (newHeight/currentHeight), _ratio); + + currentWidth = newWidth; + currentHeight = newHeight; + + _this.redraw(); + }; var _thRedraw = _.throttle(function() { @@ -331,34 +331,34 @@ // register model events this.renkan.project.on("change:save_status", function(){ - switch (_this.renkan.project.get("save_status")) { - case 0: //clean - _this.$.find(".Rk-Save-Button").removeClass("to-save"); - _this.$.find(".Rk-Save-Button").removeClass("saving"); - _this.$.find(".Rk-Save-Button").addClass("saved"); - break; - case 1: //dirty - _this.$.find(".Rk-Save-Button").removeClass("saved"); - _this.$.find(".Rk-Save-Button").removeClass("saving"); - _this.$.find(".Rk-Save-Button").addClass("to-save"); - break; - case 2: //saving - _this.$.find(".Rk-Save-Button").removeClass("saved"); - _this.$.find(".Rk-Save-Button").removeClass("to-save"); - _this.$.find(".Rk-Save-Button").addClass("saving"); - break; - } + switch (_this.renkan.project.get("save_status")) { + case 0: //clean + _this.$.find(".Rk-Save-Button").removeClass("to-save"); + _this.$.find(".Rk-Save-Button").removeClass("saving"); + _this.$.find(".Rk-Save-Button").addClass("saved"); + break; + case 1: //dirty + _this.$.find(".Rk-Save-Button").removeClass("saved"); + _this.$.find(".Rk-Save-Button").removeClass("saving"); + _this.$.find(".Rk-Save-Button").addClass("to-save"); + break; + case 2: //saving + _this.$.find(".Rk-Save-Button").removeClass("saved"); + _this.$.find(".Rk-Save-Button").removeClass("to-save"); + _this.$.find(".Rk-Save-Button").addClass("saving"); + break; + } }); - + this.renkan.project.on("change:loading_status", function(){ - if (_this.renkan.project.get("loading_status")){ - var animate = _this.$.find(".loader").addClass("run"); - var timer = setTimeout(function(){ - _this.$.find(".loader").hide(250); - }, 3000); - } + if (_this.renkan.project.get("loading_status")){ + var animate = _this.$.find(".loader").addClass("run"); + var timer = setTimeout(function(){ + _this.$.find(".loader").hide(250); + }, 3000); + } }); - + this.renkan.project.on("add:users remove:users", _thRedrawUsers); this.renkan.project.on("add:views remove:views", function(_node) { @@ -373,13 +373,13 @@ this.renkan.project.on("add:nodes", function(_node) { _this.addRepresentation("Node", _node); if (!_this.renkan.project.get("loading_status")){ - _thRedraw(); + _thRedraw(); } }); this.renkan.project.on("add:edges", function(_edge) { _this.addRepresentation("Edge", _edge); if (!_this.renkan.project.get("loading_status")){ - _thRedraw(); + _thRedraw(); } }); this.renkan.project.on("change:title", function(_model, _title) { @@ -1196,21 +1196,21 @@ } var widthAft = this.$.width(); var heightAft = this.$.height(); - + if (this.renkan.options.show_top_bar) { - heightAft -= this.$.find(".Rk-TopBar").height(); + heightAft -= this.$.find(".Rk-TopBar").height(); } if (this.renkan.options.show_bins && (this.renkan.$.find(".Rk-Bins").position().left > 0)) { - widthAft -= this.renkan.$.find(".Rk-Bins").width(); + widthAft -= this.renkan.$.find(".Rk-Bins").width(); } - + this.canvas_$.attr({ - width: widthAft, - height: heightAft + width: widthAft, + height: heightAft }); - + paper.view.viewSize = new paper.Size([this.canvas_$.width(), this.canvas_$.height()]); - + } else { for (i = 0; i < _requestMethods.length; i++) { if (typeof _el[_requestMethods[i]] === "function") { @@ -1237,8 +1237,8 @@ this.setScale( _newScale, _offset ); }, resizeZoom: function(_scaleWidth, _scaleHeight, _ratio) { - var _newScale = this.scale * _ratio, - _offset = new paper.Point([ + var _newScale = this.scale * _ratio, + _offset = new paper.Point([ (this.offset.x * _scaleWidth), (this.offset.y * _scaleHeight) ]); @@ -1306,8 +1306,8 @@ var foldBinsButton = this.$.find(".Rk-Fold-Bins"), bins = this.renkan.$.find(".Rk-Bins"); var _this = this, - sizeBef = _this.canvas_$.width(), - sizeAft; + sizeBef = _this.canvas_$.width(), + sizeAft; if (bins.position().left < 0) { bins.animate({left: 0},250); this.$.animate({left: 300},250,function() { @@ -1315,9 +1315,9 @@ paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]); }); if ((sizeBef - bins.width()) < bins.height()){ - sizeAft = sizeBef; + sizeAft = sizeBef; } else { - sizeAft = sizeBef - bins.width(); + sizeAft = sizeBef - bins.width(); } foldBinsButton.html("«"); } else {