485 |
485 |
486 }; |
486 }; |
487 |
487 |
488 _(Scene.prototype).extend({ |
488 _(Scene.prototype).extend({ |
489 fixSize: function() { |
489 fixSize: function() { |
490 // if(typeothis.view) { |
490 if(typeof this.view === 'undefined') { |
491 // this.view.setScale(view.get("zoom_level"), new paper.Point(view.get("offset"))); |
491 this.view = this.addRepresentation("View", this.renkan.project.get("views").last()); |
492 // } |
492 this.view.setScale(view.get("zoom_level"), new paper.Point(view.get("offset"))); |
493 // else{ |
493 } |
494 // this.view.autoScale(); |
494 else{ |
495 // } |
495 this.view.autoScale(); |
|
496 } |
496 }, |
497 }, |
497 drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) { |
498 drawSector: function(_repr, _inR, _outR, _startAngle, _endAngle, _padding, _imgname, _caption) { |
498 var _options = this.renkan.options, |
499 var _options = this.renkan.options, |
499 _startRads = _startAngle * Math.PI / 180, |
500 _startRads = _startAngle * Math.PI / 180, |
500 _endRads = _endAngle * Math.PI / 180, |
501 _endRads = _endAngle * Math.PI / 180, |
1199 filesaver(blob,fileNameToSaveAs); |
1200 filesaver(blob,fileNameToSaveAs); |
1200 |
1201 |
1201 }, |
1202 }, |
1202 parameters: function(_params){ |
1203 parameters: function(_params){ |
1203 if ($.isEmptyObject(_params)){ |
1204 if ($.isEmptyObject(_params)){ |
1204 this.view = this.addRepresentation("View", this.renkan.project.get("views").last()); |
1205 this.view = this.addRepresentation("View", this.renkan.project.get("views").first()); |
|
1206 this.view.autoScale(); |
1205 return; |
1207 return; |
1206 } |
1208 } |
1207 if (typeof _params.view !== 'undefined'){ |
1209 if (typeof _params.idView !== 'undefined' && typeof this.renkan.project.get("views").at(_params.idView) !== 'undefined'){ |
|
1210 this.view = this.addRepresentation("View", this.renkan.project.get("views").at(_params.idView)); |
|
1211 } |
|
1212 if (typeof _params.view !== 'undefined' && _params.view.split(",").length >= 3){ |
1208 var viewParams = _params.view.split(","); |
1213 var viewParams = _params.view.split(","); |
1209 if (viewParams.length >= 3){ |
1214 var params = { |
1210 var params = { |
1215 "project": this.renkan.project, |
1211 "project": this.renkan.project, |
1216 "offset": { |
1212 "offset": { |
1217 "x": parseFloat(viewParams[0]), |
1213 "x": parseFloat(viewParams[0]), |
1218 "y": parseFloat(viewParams[1]) |
1214 "y": parseFloat(viewParams[1]) |
1219 }, |
1215 }, |
1220 "zoom_level": parseFloat(viewParams[2]) |
1216 "zoom_level": parseFloat(viewParams[2]) |
1221 }; |
1217 }; |
1222 if (this.view){ |
1218 for (var i = 3; i < viewParams.length; i++){ |
1223 this.view.setScale(params.zoom_level, new paper.Point(params.offset)); |
1219 params.hidden_nodes.push(viewParams[i]); |
1224 } else{ |
1220 } |
|
1221 //var view = new Rkns.Models.View(params); |
|
1222 |
|
1223 if (this.view){ |
|
1224 this.view.showNodes(false); |
|
1225 this.removeRepresentation(this.view); |
|
1226 } |
|
1227 |
|
1228 this.view = this.addRepresentation("View", null); |
1225 this.view = this.addRepresentation("View", null); |
1229 this.view.params = params; |
1226 this.view.params = params; |
1230 this.view.init(); |
1227 this.view.init(); |
1231 } else { |
1228 } |
1232 this.view = this.addRepresentation("View", this.renkan.project.get("views").last()); |
1229 } |
1233 } |
1230 if(!this.view){ |
|
1231 this.view = this.addRepresentation("View", this.renkan.project.get("views").first()); |
|
1232 this.view.autoScale(); |
1234 } |
1233 } |
1235 //other parameters must go after because most of them depends on a view that must be initialize before |
1234 //other parameters must go after because most of them depends on a view that must be initialize before |
1236 if (typeof _params.idNode !== 'undefined'){ |
1235 if (typeof _params.idNode !== 'undefined'){ |
1237 this.unhighlightAll(); |
1236 this.unhighlightAll(); |
1238 this.highlightModel(this.renkan.project.get("nodes").get(_params.iNnode)); |
1237 this.highlightModel(this.renkan.project.get("nodes").get(_params.iNnode)); |