client/js/renderer/scene.js
changeset 543 5f7bebdcfc0d
parent 534 c25e7c9e26a0
child 544 08c496adb0f0
equal deleted inserted replaced
534:c25e7c9e26a0 543:5f7bebdcfc0d
    27         this.selected_target = null;
    27         this.selected_target = null;
    28         this.edge_layer = new paper.Layer();
    28         this.edge_layer = new paper.Layer();
    29         this.node_layer = new paper.Layer();
    29         this.node_layer = new paper.Layer();
    30         this.buttons_layer = new paper.Layer();
    30         this.buttons_layer = new paper.Layer();
    31         this.delete_list = [];
    31         this.delete_list = [];
    32         this.redrawActive = true;
    32         this.redrawActive = false;
    33 
    33 
    34         if (_renkan.options.show_minimap) {
    34         if (_renkan.options.show_minimap) {
    35             this.minimap = {
    35             this.minimap = {
    36                     background_layer: new paper.Layer(),
    36                     background_layer: new paper.Layer(),
    37                     edge_layer: new paper.Layer(),
    37                     edge_layer: new paper.Layer(),
   264         });
   264         });
   265         bindClick(".Rk-Fold-Bins", "foldBins");
   265         bindClick(".Rk-Fold-Bins", "foldBins");
   266 
   266 
   267         paper.view.onResize = function(_event) {
   267         paper.view.onResize = function(_event) {
   268             var _ratio,
   268             var _ratio,
   269                 newWidth = _event.width,
   269                 newWidth = _event.size._width,
   270                 newHeight = _event.height;
   270                 newHeight = _event.size._height;
   271 
   271             
   272             if (_this.minimap) {
   272             if (_this.minimap) {
   273                 _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size);
   273                 _this.minimap.topleft = paper.view.bounds.bottomRight.subtract(_this.minimap.size);
   274                 _this.minimap.rectangle.fitBounds(_this.minimap.topleft.subtract([2,2]), _this.minimap.size.add([4,4]));
   274                 _this.minimap.rectangle.fitBounds(_this.minimap.topleft.subtract([2,2]), _this.minimap.size.add([4,4]));
   275                 _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size);
   275                 _this.minimap.cliprectangle.fitBounds(_this.minimap.topleft, _this.minimap.size);
   276             }
   276             }
   280             if (newHeight < newWidth) {
   280             if (newHeight < newWidth) {
   281                     _ratio = ratioH;
   281                     _ratio = ratioH;
   282             } else {
   282             } else {
   283                 _ratio = ratioW;
   283                 _ratio = ratioW;
   284             }
   284             }
   285 
       
   286             _this.view.resizeZoom(ratioW, ratioH, _ratio);
   285             _this.view.resizeZoom(ratioW, ratioH, _ratio);
   287 
   286 
   288             _this.redraw();
   287             _this.redraw();
   289 
   288 
   290         };
   289         };
   327                     _this.$.find(".Rk-Save-Button").removeClass("to-save");
   326                     _this.$.find(".Rk-Save-Button").removeClass("to-save");
   328                     _this.$.find(".Rk-Save-Button").addClass("saving");
   327                     _this.$.find(".Rk-Save-Button").addClass("saving");
   329                     break;
   328                     break;
   330             }
   329             }
   331         });
   330         });
   332 
   331         
       
   332         this.renkan.project.on("loaded", function(){
       
   333             Backbone.history.start();
       
   334             _this.redrawActive = true;
       
   335             _thRedraw();
       
   336         });
       
   337         
   333         this.renkan.project.on("change:loadingStatus", function(){
   338         this.renkan.project.on("change:loadingStatus", function(){
   334             if (_this.renkan.project.get("loadingStatus")){
   339             if (_this.renkan.project.get("loadingStatus")){
   335                 var animate = _this.$.find(".loader").addClass("run");
   340                 var animate = _this.$.find(".loader").addClass("run");
   336                 var timer = setTimeout(function(){
   341                 var timer = setTimeout(function(){
   337                     _this.$.find(".loader").hide(250);
   342                     _this.$.find(".loader").hide(250);
   338                 }, 3000);
   343                 }, 3000);
   339             }
   344             }
   340             else{
       
   341                 Backbone.history.start();
       
   342                 _thRedraw();
       
   343             }
       
   344         });
   345         });
   345 
   346 
   346         this.renkan.project.on("add:users remove:users", _thRedrawUsers);
   347         this.renkan.project.on("add:users remove:users", _thRedrawUsers);
   347 
   348 
   348         this.renkan.project.on("add:views remove:views", function(_node) {
   349         this.renkan.project.on("add:views remove:views", function(_node) {
   349             if(_this.renkan.project.get('views').length > 0) {
   350             if(_this.renkan.project.get('views').length > 1) {
   350                 _this.$.find(".Rk-ZoomSetSaved").show();
   351                 _this.$.find(".Rk-ZoomSetSaved").show();
   351             }
   352             }
   352             else {
   353             else {
   353                 _this.$.find(".Rk-ZoomSetSaved").hide();
   354                 _this.$.find(".Rk-ZoomSetSaved").hide();
   354             }
   355             }
  1283                     paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);
  1284                     paper.view.viewSize = new paper.Size([w, _this.canvas_$.height()]);
  1284                 });
  1285                 });
  1285                 sizeAft = sizeBef+300;
  1286                 sizeAft = sizeBef+300;
  1286                 foldBinsButton.html("&raquo;");
  1287                 foldBinsButton.html("&raquo;");
  1287             }
  1288             }
  1288             _this.view.resizeZoom(1, 1, (sizeAft/sizeBef));
       
  1289         },
  1289         },
  1290         save: function() { },
  1290         save: function() { },
  1291         open: function() { }
  1291         open: function() { }
  1292     }).value();
  1292     }).value();
  1293 
  1293