Skip to content

Commit

Permalink
adjusted CSS column algorithm in reflowable view to take into account…
Browse files Browse the repository at this point in the history
… single-column vertical writing mode (user setting has no effect, max text width corresponds 2x single-column threshold)
  • Loading branch information
danielweck committed Sep 8, 2014
1 parent 03cc95b commit 9a30f50
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions js/views/reflowable_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,15 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){


function updatePagination() {


// At 100% font-size = 16px (on HTML, not body or descendant markup!)
var MAXW = 550; //TODO user/vendor-configurable?
var MINW = 400;

var isDoublePageSyntheticSpread = ReadiumSDK.Helpers.deduceSyntheticSpread(_$viewport, _currentSpineItem, _viewSettings);

var forced = (isDoublePageSyntheticSpread === false) || (isDoublePageSyntheticSpread === true);
// excludes 0 and 1 truthy values which denote non-forced result
// excludes 0 and 1 falsy/truthy values which denote non-forced result

// console.debug("isDoublePageSyntheticSpread: " + isDoublePageSyntheticSpread);
// console.debug("forced: " + forced);
Expand All @@ -512,8 +516,17 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){
// console.debug("TRYING SPREAD INSTEAD OF SINGLE...");
}

_paginationInfo.visibleColumnCount = _htmlBodyIsVerticalWritingMode ? 1 : (isDoublePageSyntheticSpread ? 2 : 1);
_paginationInfo.visibleColumnCount = isDoublePageSyntheticSpread ? 2 : 1;

if (_htmlBodyIsVerticalWritingMode)
{
MAXW *= 2;
isDoublePageSyntheticSpread = false;
forced = true;
_paginationInfo.visibleColumnCount = 1;
// console.debug("Vertical Writing Mode => single CSS column, but behaves as if two-page spread");
}

if(!_$epubHtml) {
return;
}
Expand All @@ -529,10 +542,6 @@ ReadiumSDK.Views.ReflowableView = function(options, reader){

var filler = 0;

// At 100% font-size = 16px (on HTML, not body or descendant markup!)
var MAXW = 550; //TODO user/vendor-configurable?
var MINW = 400;

// var win = _$iframe[0].contentDocument.defaultView || _$iframe[0].contentWindow;
// var htmlBodyComputedStyle = win.getComputedStyle(_$htmlBody[0], null);
// if (htmlBodyComputedStyle)
Expand Down

0 comments on commit 9a30f50

Please sign in to comment.