Skip to content

Commit

Permalink
fixed page rounding error, built
Browse files Browse the repository at this point in the history
  • Loading branch information
fchasen committed Apr 4, 2014
1 parent ae7c84a commit 0888642
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 22 deletions.
5 changes: 2 additions & 3 deletions build/epub.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/epub.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/epub.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/epub.min.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions build/epub_no_underscore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/epub_no_underscore.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/hooks.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/hooks.min.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hooks/default/endnotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions hooks/extensions/hypothesis.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
2 changes: 1 addition & 1 deletion reader/js/epub.js.map

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions reader/js/epub.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0888642

Please sign in to comment.