--- a/client/js/renderer/scene.js Thu Sep 24 17:47:11 2015 +0200
+++ b/client/js/renderer/scene.js Tue Sep 29 18:47:11 2015 +0200
@@ -339,6 +339,11 @@
_thRedraw();
});
+ //register router events
+ this.renkan.router.on("router", function(_params){
+ _this.setViewparameters(_params);
+ });
+
this.renkan.project.on("change:loadingStatus", function(){
if (_this.renkan.project.get("loadingStatus")){
var animate = _this.$.find(".loader").addClass("run");
@@ -382,11 +387,6 @@
}
});
- //register router events
- this.renkan.router.on("router", function(_params){
- _this.setViewparameters(_params);
- });
-
if (_renkan.options.size_bug_fix) {
var _delay = (
typeof _renkan.options.size_bug_fix === "number" ?
@@ -494,7 +494,7 @@
_(Scene.prototype).extend({
fixSize: function() {
if(typeof this.view === 'undefined') {
- this.view = this.addRepresentation("View", this.renkan.project.get("views").first());
+ this.view = this.addRepresentation("View", this.renkan.project.get("views").last());
}
this.view.autoScale();
},
@@ -1207,16 +1207,12 @@
this.removeRepresentationsOfType("View");
if ($.isEmptyObject(_params)){
this.view = this.addRepresentation("View", this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view)));
- if (!this.renkan.options.default_view){
- this.view.autoScale();
- }
return;
}
if (typeof _params.viewIndex !== 'undefined'){
this.view = this.addRepresentation("View", this.renkan.project.get("views").at(this.validViewIndex(_params.viewIndex)));
- if (!this.renkan.options.default_view){
- this.view.autoScale();
- }
+ } else {
+ this.view = this.addRepresentation("View", this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view)));
}
if (typeof _params.view !== 'undefined' && _params.view.split(",").length >= 3){
var viewParams = _params.view.split(",");
@@ -1228,18 +1224,21 @@
},
"zoom_level": parseFloat(viewParams[2])
};
- if (this.view){
- this.view.setScale(params.zoom_level, new paper.Point(params.offset));
- } else{
- this.view = this.addRepresentation("View", null);
- this.view.params = params;
- this.view.initWithParams();
+ this.view.setScale(params.zoom_level, new paper.Point(params.offset));
+ }
+ //if view parameters = autoscale or views_parameters options is false, we apply a zoom fit on the view.
+ if ((typeof _params.view !== 'undefined' && _params.view === "autoscale")){
+ this.view.autoScale();
+ }
+ //if viewsNodes = false or views_nodes options is false, we show all the node by default.
+ if (typeof _params.viewsNodes !== 'undefined'){
+ if (_params.viewsNodes === "true"){
+ this.view.hiddenNodes = (this.view.params.hidden_nodes || []).concat();
+ this.view.hideNodes();
+ } else {
+ this.view.showNodes(false);
}
}
- if (!this.view){
- this.view = this.addRepresentation("View", this.renkan.project.get("views").at(this.validViewIndex(this.renkan.options.default_index_view)));
- this.view.autoScale();
- }
//other parameters must go after because most of them depends on a view that must be initialize before
this.unhighlightAll();
if (typeof _params.idNode !== 'undefined'){