1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-04 15:09:16 +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

@ -4037,7 +4037,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,
@ -4091,11 +4091,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

File diff suppressed because one or more lines are too long

2
build/epub.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4036,7 +4036,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,
@ -4090,11 +4090,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

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@ EPUBJS.Hooks.register("beforeChapterDisplay").endnotes = function(callback, rend
attr = "epub:type",
type = "noteref",
folder = EPUBJS.core.folder(location.pathname),
cssPath = folder + EPUBJS.cssPath || folder,
cssPath = (folder + EPUBJS.cssPath) || folder,
popups = {};
EPUBJS.core.addCss(cssPath + "popup.css", false, renderer.render.document.head);

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@ EPUBJS.Hooks.register("beforeChapterDisplay").endnotes = function(callback, rend
attr = "epub:type",
type = "noteref",
folder = EPUBJS.core.folder(location.pathname),
cssPath = folder + EPUBJS.cssPath || folder,
cssPath = (folder + EPUBJS.cssPath) || folder,
popups = {};
EPUBJS.core.addCss(cssPath + "popup.css", false, renderer.render.document.head);

View file

@ -9,12 +9,14 @@
//
//
EPUBJS.Hooks.register("beforeChapterDisplay").hypothesis = function(callback, renderer){
var folder = EPUBJS.core.folder(location.pathname);
var cssPath = (folder + EPUBJS.cssPath) || folder;
if(!renderer) return;
EPUBJS.core.addScript("https://hypothes.is/app/embed.js?role=guest&light=true", null, renderer.doc.head);
EPUBJS.core.addCss("/demo/css/annotations.css", null, renderer.doc.head);
EPUBJS.core.addCss( cssPath + "annotations.css", null, renderer.doc.head);
if(callback) callback();
};

File diff suppressed because one or more lines are too long

View file

@ -4037,7 +4037,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,
@ -4091,11 +4091,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

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