# HG changeset patch # User ymh # Date 1382621384 -7200 # Node ID 583dc519c5fa07d2bf260923dd4820a7493a0666 # Parent e09ff1ce23ba992ba84bf3843330b840cdaa418f Add an initialScale to make the MIN_SCALE and MAX_SCALE relative to the graph. diff -r e09ff1ce23ba -r 583dc519c5fa client/js/paper-renderer.js --- a/client/js/paper-renderer.js Wed Oct 23 03:09:47 2013 +0200 +++ b/client/js/paper-renderer.js Thu Oct 24 15:29:44 2013 +0200 @@ -1577,6 +1577,7 @@ this.notif_$ = this.$.find(".Rk-Notifications"); paper.setup(this.canvas_$[0]); this.scale = 1; + this.initialScale = 1; this.offset = paper.view.center; this.totalScroll = 0; this.mouse_down = false; @@ -2160,7 +2161,7 @@ this.redrawUsers(); }, setScale: function(_newScale, _offset) { - if (_newScale > _MIN_SCALE && _newScale < _MAX_SCALE) { + if ((_newScale/this.initialScale) > _MIN_SCALE && (_newScale/this.initialScale) < _MAX_SCALE) { this.scale = _newScale; if (_offset) { this.offset = _offset; @@ -2177,7 +2178,8 @@ _miny = Math.min.apply(Math, _yy), _maxx = Math.max.apply(Math, _xx), _maxy = Math.max.apply(Math, _yy); - var _scale = Math.max(_MIN_SCALE, Math.min(_MAX_SCALE, (paper.view.size.width - 2 * this.renkan.options.autoscale_padding) / (_maxx - _minx), (paper.view.size.height - 2 * this.renkan.options.autoscale_padding) / (_maxy - _miny))); + var _scale = Math.min( (paper.view.size.width - 2 * this.renkan.options.autoscale_padding) / (_maxx - _minx), (paper.view.size.height - 2 * this.renkan.options.autoscale_padding) / (_maxy - _miny)); + this.initialScale = _scale; this.setScale(_scale, paper.view.center.subtract(new paper.Point([(_maxx + _minx) / 2, (_maxy + _miny) / 2]).multiply(_scale))); } if (nodes.length === 1) { diff -r e09ff1ce23ba -r 583dc519c5fa client/publish-test.html --- a/client/publish-test.html Wed Oct 23 03:09:47 2013 +0200 +++ b/client/publish-test.html Thu Oct 24 15:29:44 2013 +0200 @@ -23,10 +23,10 @@ $(function() { _renkan = new Rkns.Renkan({ editor_mode: false, - show_bins: false + show_bins: false, }); Rkns.jsonIO(_renkan, { - url: "http://renkan.iri-research.org/renkan/rest/projects/ef7ea617-df99-4c73-b4b6-0408f2e503f3?callback=?" + url: "http://renkan.iri-research.org/renkan/rest/projects/696e5544-3b44-11e3-8312-5fa5e5b09a85?callback=?" }); });