364 _this.addRepresentation("Edge", _edge); |
363 _this.addRepresentation("Edge", _edge); |
365 if (!_this.renkan.project.get("loadingStatus")){ |
364 if (!_this.renkan.project.get("loadingStatus")){ |
366 _thRedraw(); |
365 _thRedraw(); |
367 } |
366 } |
368 }); |
367 }); |
369 // this.renkan.project.on("add:views", function(_view) { |
|
370 // if (!_this.view){ |
|
371 // _this.view = _this.addRepresentation("View", _view); |
|
372 // } |
|
373 // if (!_this.renkan.project.get("loadingStatus")){ |
|
374 // _thRedraw(); |
|
375 // } |
|
376 // }); |
|
377 this.renkan.project.on("change:title", function(_model, _title) { |
368 this.renkan.project.on("change:title", function(_model, _title) { |
378 var el = _this.$.find(".Rk-PadTitle"); |
369 var el = _this.$.find(".Rk-PadTitle"); |
379 if (el.is("input")) { |
370 if (el.is("input")) { |
380 if (el.val() !== _title) { |
371 if (el.val() !== _title) { |
381 el.val(_title); |
372 el.val(_title); |
494 |
485 |
495 }; |
486 }; |
496 |
487 |
497 _(Scene.prototype).extend({ |
488 _(Scene.prototype).extend({ |
498 fixSize: function() { |
489 fixSize: function() { |
499 if( this.renkan.options.default_view && this.view) { |
490 // if(typeothis.view) { |
500 this.view.setScale(view.get("zoom_level"), new paper.Point(view.get("offset"))); |
491 // this.view.setScale(view.get("zoom_level"), new paper.Point(view.get("offset"))); |
501 } |
492 // } |
502 else{ |
493 // else{ |
503 this.view.autoScale(); |
494 // this.view.autoScale(); |
504 } |
495 // } |
505 }, |
496 }, |
506 drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) { |
497 drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) { |
507 var _options = this.renkan.options, |
498 var _options = this.renkan.options, |
508 _startRads = _startAngle * Math.PI / 180, |
499 _startRads = _startAngle * Math.PI / 180, |
509 _endRads = _endAngle * Math.PI / 180, |
500 _endRads = _endAngle * Math.PI / 180, |
691 }, |
682 }, |
692 addRepresentation: function(_type, _model) { |
683 addRepresentation: function(_type, _model) { |
693 var RendererType = requtils.getRenderer()[_type]; |
684 var RendererType = requtils.getRenderer()[_type]; |
694 var _repr = new RendererType(this, _model); |
685 var _repr = new RendererType(this, _model); |
695 this.representations.push(_repr); |
686 this.representations.push(_repr); |
696 return _repr; |
687 return _repr; |
697 }, |
688 }, |
698 addRepresentations: function(_type, _collection) { |
689 addRepresentations: function(_type, _collection) { |
699 var _this = this; |
690 var _this = this; |
700 _collection.forEach(function(_model) { |
691 _collection.forEach(function(_model) { |
701 _this.addRepresentation(_type, _model); |
692 _this.addRepresentation(_type, _model); |
1210 var blob = new Blob([projectJSONStr], {type: "application/json;charset=utf-8"}); |
1201 var blob = new Blob([projectJSONStr], {type: "application/json;charset=utf-8"}); |
1211 filesaver(blob,fileNameToSaveAs); |
1202 filesaver(blob,fileNameToSaveAs); |
1212 |
1203 |
1213 }, |
1204 }, |
1214 parameters: function(_params){ |
1205 parameters: function(_params){ |
|
1206 if ($.isEmptyObject(_params)){ |
|
1207 this.view = this.addRepresentation("View", this.renkan.project.get("views").last()); |
|
1208 return; |
|
1209 } |
1215 if (typeof _params.idnode !== 'undefined'){ |
1210 if (typeof _params.idnode !== 'undefined'){ |
|
1211 console.log('params idnode'); |
1216 this.unhighlightAll(); |
1212 this.unhighlightAll(); |
1217 this.highlightModel(this.renkan.project.get("nodes").get(_params.idnode)); |
1213 this.highlightModel(this.renkan.project.get("nodes").get(_params.idnode)); |
|
1214 } |
|
1215 if (typeof _params.view !== 'undefined'){ |
|
1216 var viewParams = _params.view.split(","); |
|
1217 if (viewParams.length >= 3){ |
|
1218 var params = { |
|
1219 "project": this.renkan.project, |
|
1220 "zoom_level": parseFloat(viewParams[0]), |
|
1221 "offset": { |
|
1222 "x": parseFloat(viewParams[1]), |
|
1223 "y": parseFloat(viewParams[2]) |
|
1224 }, |
|
1225 "hidden_nodes": [] |
|
1226 }; |
|
1227 for (var i = 3; i < viewParams.length; i++){ |
|
1228 params.hidden_nodes.push(viewParams[i]); |
|
1229 } |
|
1230 //var view = new Rkns.Models.View(params); |
|
1231 |
|
1232 if (this.view){ |
|
1233 this.view.showNodes(false); |
|
1234 this.removeRepresentation(this.view); |
|
1235 } |
|
1236 |
|
1237 this.view = this.addRepresentation("View", null); |
|
1238 this.view.params = params; |
|
1239 this.view.init(); |
|
1240 } else { |
|
1241 this.view = this.addRepresentation("View", this.renkan.project.get("views").last()); |
|
1242 } |
1218 } |
1243 } |
1219 }, |
1244 }, |
1220 foldBins: function() { |
1245 foldBins: function() { |
1221 var foldBinsButton = this.$.find(".Rk-Fold-Bins"), |
1246 var foldBinsButton = this.$.find(".Rk-Fold-Bins"), |
1222 bins = this.renkan.$.find(".Rk-Bins"); |
1247 bins = this.renkan.$.find(".Rk-Bins"); |