1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-03 14:59:18 +02:00

fixed page rounding error, built

This commit is contained in:
Fred Chasen 2014-04-03 22:40:50 -07:00
parent ae7c84aa8a
commit 08886428e2
13 changed files with 20 additions and 22 deletions

View file

@ -45,7 +45,7 @@ EPUBJS.Layout.Reflowable.prototype.calculatePages = function() {
var totalWidth, displayedPages;
this.documentElement.style.width = "auto"; //-- reset width for calculations
totalWidth = this.documentElement.scrollWidth;
displayedPages = Math.round(totalWidth / this.spreadWidth);
displayedPages = Math.ceil(totalWidth / this.spreadWidth);
return {
displayedPages : displayedPages,
@ -99,11 +99,10 @@ EPUBJS.Layout.ReflowableSpreads.prototype.format = function(documentElement, _wi
EPUBJS.Layout.ReflowableSpreads.prototype.calculatePages = function() {
var totalWidth = this.documentElement.scrollWidth;
var displayedPages = Math.round(totalWidth / this.spreadWidth);
var displayedPages = Math.ceil(totalWidth / this.spreadWidth);
//-- Add a page to the width of the document to account an for odd number of pages
this.documentElement.style.width = totalWidth + this.spreadWidth + "px";
return {
displayedPages : displayedPages,
pageCount : displayedPages * 2