client/js/paper-renderer.js
changeset 281 9ff388c9bc8d
parent 278 b45dda454dd6
child 282 12ee99b182cd
equal deleted inserted replaced
280:1be105c235c5 281:9ff388c9bc8d
     1 /* paper-renderer.js */
     1 /* paper-renderer.js */
     2 "use strict";
     2 "use strict";
     3 
     3 
     4 (function(root) {
     4 (function(root) {
     5 
     5 	
     6     var Rkns = root.Rkns,
     6     var Rkns = root.Rkns,
     7     _ = Rkns._,
     7     _ = Rkns._,
     8     $ = Rkns.$;
     8     $ = Rkns.$;
     9 
     9 
    10     /* Rkns.Renderer Object */
    10     /* Rkns.Renderer Object */
  1794 
  1794 
  1795         bindClick(".Rk-ZoomOut", "zoomOut");
  1795         bindClick(".Rk-ZoomOut", "zoomOut");
  1796         bindClick(".Rk-ZoomIn", "zoomIn");
  1796         bindClick(".Rk-ZoomIn", "zoomIn");
  1797         bindClick(".Rk-ZoomFit", "autoScale");
  1797         bindClick(".Rk-ZoomFit", "autoScale");
  1798         this.$.find(".Rk-ZoomSave").click( function() {
  1798         this.$.find(".Rk-ZoomSave").click( function() {
  1799             _this.renkan.project.set("views", [{id:Rkns.Utils.getUID('view'), zoom_level:_this.scale, offset_x:_this.offset.x, offset_y:_this.offset.y}]); // Save scale
  1799         	// Save scale and offset point
       
  1800         	_this.renkan.project.addView( { id:Rkns.Utils.getUID('view'), zoom_level:_this.scale, offset_x:_this.offset.x, offset_y:_this.offset.y } );
  1800             _this.$.find(".Rk-ZoomSetSaved").show();
  1801             _this.$.find(".Rk-ZoomSetSaved").show();
  1801         });
  1802         });
  1802         this.$.find(".Rk-ZoomSetSaved").click( function() {
  1803         this.$.find(".Rk-ZoomSetSaved").click( function() {
  1803             var view = _this.renkan.project.get("views")[0];
  1804             var view = _this.renkan.project.get("views").last();
  1804             _this.setScale(view.zoom_level, new paper.Point(view.offset_x, view.offset_y));
  1805             if(view){
       
  1806             	_this.setScale(view.get("zoom_level"), new paper.Point(view.get("offset_x"), view.get("offset_y")));
       
  1807             }
  1805         });
  1808         });
  1806         if(this.renkan.read_only && !isNaN(parseInt(this.renkan.options.default_view))){
  1809         if(this.renkan.read_only && !isNaN(parseInt(this.renkan.options.default_view))){
  1807             this.$.find(".Rk-ZoomSetSaved").show();
  1810             this.$.find(".Rk-ZoomSetSaved").show();
  1808         }
  1811         }
  1809         this.$.find(".Rk-CurrentUser").mouseenter(
  1812         this.$.find(".Rk-CurrentUser").mouseenter(