--- a/client/js/renderer/viewrepr.js Thu Jun 25 18:09:49 2015 +0200
+++ b/client/js/renderer/viewrepr.js Tue Aug 04 18:02:54 2015 +0200
@@ -97,6 +97,7 @@
addHiddenNode: function(_model){
this.hideNode(_model);
this.hiddenNodes.push(_model.id);
+ this.updateUrl();
},
hideNode: function(_model){
if (typeof this.renderer.getRepresentationByModel(_model) !== 'undefined'){
@@ -132,6 +133,7 @@
this.offset = _offset;
}
this.renderer.redraw();
+ this.updateUrl();
}
},
zoomOut: function() {
@@ -183,9 +185,25 @@
},
paperShift: function(_delta) {
this.offset = this.offset.add(_delta);
- this.renderer.offset = this.renderer.offset.add(_delta);
this.renderer.redraw();
},
+ updateUrl: function(){
+ if(this.options.update_url){
+ var result = {};
+ var parameters = Backbone.history.getFragment().split('?');
+ if (parameters.length > 1){
+ parameters[1].split("&").forEach(function(part) {
+ var item = part.split("=");
+ result[item[0]] = decodeURIComponent(item[1]);
+ });
+ }
+ result.view = Math.round(this.offset.x*1000)/1000 + ',' + Math.round(this.offset.y*1000)/1000 + ',' + Math.round(this.scale*1000)/1000;
+// if (this.hiddenNodes.length > 0){
+// result.hiddenNodes = this.hiddenNodes.join();
+// }
+ this.renkan.router.navigate("?" + decodeURIComponent($.param(result)), {trigger: false, replace: false});
+ }
+ },
}).value();
return ViewRepr;