mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +02:00
Added relocated event
This commit is contained in:
parent
aa9c2535d9
commit
3f4d7bbbf2
18 changed files with 250 additions and 58 deletions
|
@ -180,14 +180,28 @@ class Layout {
|
|||
* @return {number} spreads
|
||||
* @return {number} pages
|
||||
*/
|
||||
count(totalWidth) {
|
||||
count(totalLength, pageLength) {
|
||||
// var totalWidth = contents.scrollWidth();
|
||||
var spreads = Math.ceil( totalWidth / this.delta);
|
||||
let spreads, pages;
|
||||
|
||||
if (this.name === "pre-paginated") {
|
||||
spreads = 1;
|
||||
pages = 1;
|
||||
} else if (this._flow === "paginated") {
|
||||
pageLength = pageLength || this.delta;
|
||||
spreads = Math.ceil( totalLength / pageLength);
|
||||
pages = spreads * this.divisor;
|
||||
} else { // scrolled
|
||||
pageLength = pageLength || this.height;
|
||||
spreads = Math.ceil( totalLength / pageLength);
|
||||
pages = spreads;
|
||||
}
|
||||
|
||||
return {
|
||||
spreads : spreads,
|
||||
pages : spreads * this.divisor
|
||||
spreads,
|
||||
pages
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue