client/js/renderer/scene.js
changeset 414 276042cb477c
parent 412 1ebaa106b580
child 419 4f458e6d32bd
--- a/client/js/renderer/scene.js	Sat Mar 28 04:28:21 2015 +0100
+++ b/client/js/renderer/scene.js	Mon Mar 30 09:53:48 2015 +0200
@@ -242,7 +242,7 @@
                 _this.setScale(view.get("zoom_level"), new paper.Point(view.get("offset")));
             }
         });
-        if(this.renkan.project.get("views").length > 0 && !isNaN(parseInt(this.renkan.options.default_view))){
+        if(this.renkan.project.get("views").length > 0 && this.renkan.options.save_view){
             this.$.find(".Rk-ZoomSetSaved").show();
         }
         this.$.find(".Rk-CurrentUser").mouseenter(
@@ -392,7 +392,7 @@
             );
             window.setTimeout(
                     function() {
-                        _this.fixSize(true);
+                        _this.fixSize();
                     },
                     _delay
             );
@@ -400,7 +400,7 @@
 
         if (_renkan.options.force_resize) {
             $(window).resize(function() {
-                _this.fixSize(false);
+                _this.autoScale();
             });
         }
 
@@ -516,20 +516,17 @@
                 '<div class="Rk-Labels"></div><canvas class="Rk-Canvas" <% if (options.resize) { %> resize="" <% } %>></canvas><div class="Rk-Notifications"></div><div class="Rk-Editor">' +
                 '<% if (options.show_bins) { %><div class="Rk-Fold-Bins">&laquo;</div><% } %>' +
                 '<% if (options.show_zoom) { %><div class="Rk-ZoomButtons"><div class="Rk-ZoomIn" title="<%-translate("Zoom In")%>"></div><div class="Rk-ZoomFit" title="<%-translate("Zoom Fit")%>"></div><div class="Rk-ZoomOut" title="<%-translate("Zoom Out")%>"></div>' +
-                '<% if (options.editor_mode && !isNaN(parseInt(options.default_view))) { %><div class="Rk-ZoomSave" title="<%-translate("Zoom Save")%>"></div><% } %>' +
-                '<% if (!isNaN(parseInt(options.default_view))) { %><div class="Rk-ZoomSetSaved" title="<%-translate("View saved zoom")%>"></div><% } %></div><% } %>' +
+                '<% if (options.editor_mode && options.save_view) { %><div class="Rk-ZoomSave" title="<%-translate("Zoom Save")%>"></div><% } %>' +
+                '<% if (options.save_view) { %><div class="Rk-ZoomSetSaved" title="<%-translate("View saved zoom")%>"></div><% } %></div><% } %>' +
                 '</div></div>'
         ),
-        fixSize: function(_autoscale) {
-
-            if (_autoscale) {
-                // If _autoscale, we get the initial view (zoom+offset) set in the project datas.
-                if(this.renkan.read_only && !isNaN(parseInt(this.renkan.options.default_view))){
-                    this.autoScale(this.renkan.project.get("views")[parseInt(this.renkan.options.default_view)]);
-                }
-                else{
-                    this.autoScale();
-                }
+        fixSize: function() {
+            if( this.renkan.options.default_view && this.renkan.project.get("views").length > 0) {
+                var view = this.renkan.project.get("views").last();
+                this.setScale(view.get("zoom_level"), new paper.Point(view.get("offset")));
+            }
+            else{
+                this.autoScale();
             }
         },
         drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) {