Skip to content

Commit

Permalink
overflow should only be enabled for fixed-layout pan-zoom, not reflow…
Browse files Browse the repository at this point in the history
… or scroll views. Fixes readium/readium-js-viewer#232

(fixes Chrome extension/cloud reader, as well as native apps (although they do not expose "zoom" UI affordances yet))
(trivial tested fix, no need for feature branch + pull request)
  • Loading branch information
danielweck committed Oct 23, 2014
1 parent 8b1749a commit 6b89df6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/views/fixed_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ ReadiumSDK.Views.FixedView = function(options, reader){

var horScale = potentialContentSize.width / _contentMetaSize.width;
var verScale = potentialContentSize.height / _contentMetaSize.height;


_$viewport.css("overflow", "auto");

var scale;
if (_zoom.style == 'fit-width'){
scale = horScale;
Expand All @@ -326,6 +328,9 @@ ReadiumSDK.Views.FixedView = function(options, reader){
}
else{
scale = Math.min(horScale, verScale);

// no need for pan during "viewport fit" zoom
_$viewport.css("overflow", "hidden");
}

_currentScale = scale;
Expand Down
7 changes: 7 additions & 0 deletions js/views/reader_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ ReadiumSDK.Views.ReaderView = function(options) {

this.createViewForType = function(viewType, options) {
var createdView;

// NOTE: _$el == options.$viewport
_$el.css("overflow", "hidden");

switch(viewType) {
case ReadiumSDK.Views.ReaderView.VIEW_TYPE_FIXED:

_$el.css("overflow", "auto"); // for content pan, see self.setZoom()

createdView = new ReadiumSDK.Views.FixedView(options, self);
break;
case ReadiumSDK.Views.ReaderView.VIEW_TYPE_SCROLLED_DOC:
Expand Down

0 comments on commit 6b89df6

Please sign in to comment.