From: Michael Ang Date: Tue, 18 May 2010 01:02:34 +0000 (+0000) Subject: Restore showing of "Auto" in 2up for zoom mode. Some fixes when switching between... X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=c5261a375e732c1338c5717c4987765cf59bfd24;p=bookreader.git Restore showing of "Auto" in 2up for zoom mode. Some fixes when switching between modes. --- diff --git a/BookReader/BookReader.js b/BookReader/BookReader.js index e4f955f..6e1a5c0 100644 --- a/BookReader/BookReader.js +++ b/BookReader/BookReader.js @@ -101,7 +101,7 @@ function BookReader() { coverInternalPadding: 10, // Width of cover coverExternalPadding: 10, // Padding outside of cover bookSpineDivWidth: 30, // Width of book spine $$$ consider sizing based on book length - autofit: true + autofit: 'auto', }; // Background color for pages (e.g. when loading page image) @@ -159,7 +159,7 @@ BookReader.prototype.init = function() { $("#BRcontainer").bind('scroll', this, function(e) { e.data.loadLeafs(); }); - + this.setupKeyListeners(); this.startLocationPolling(); @@ -167,6 +167,9 @@ BookReader.prototype.init = function() { //console.log('resize!'); if (1 == e.data.mode) { //console.log('centering 1page view'); + if (e.data.autofit) { + e.data.resizePageView(); + } e.data.centerPageView(); $('#BRpageview').empty() e.data.displayedIndices = []; @@ -876,6 +879,12 @@ BookReader.prototype.zoom1up = function(direction) { } var reduceFactor = this.nextReduce(this.reduce, direction, this.onePage.reductionFactors); + + if (this.reduce == reduceFactor.reduce) { + // Already at this level + return; + } + this.reduce = reduceFactor.reduce; // $$$ incorporate into function this.autofit = reduceFactor.autofit; @@ -939,7 +948,10 @@ BookReader.prototype.resizePageView1up = function() { this.onePageCalculateReductionFactors( $('#BRcontainer').attr('clientWidth'), $('#BRcontainer').attr('clientHeight') ); // Update current reduce (if in autofit) - // this.onePageUpdateReduce(); // XXX + if (this.autofit) { + var reductionFactor = this.nextReduce(this.reduce, this.autofit, this.onePage.reductionFactors); + this.reduce = reductionFactor.reduce; + } for (i=0; i