mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-02 14:49:16 +02:00
Fix last\first spine methods
This commit is contained in:
parent
3397c41a6b
commit
ce8dc1e4ba
1 changed files with 4 additions and 4 deletions
|
@ -212,25 +212,25 @@ class Spine {
|
|||
first() {
|
||||
let index = 0;
|
||||
|
||||
while (index < this.spineItems.length-1) {
|
||||
do {
|
||||
let next = this.get(index);
|
||||
if (next && next.linear) {
|
||||
return next;
|
||||
}
|
||||
index += 1;
|
||||
}
|
||||
} while (index < this.spineItems.length-1) ;
|
||||
}
|
||||
|
||||
last() {
|
||||
let index = this.spineItems.length-1;
|
||||
|
||||
while (index > 0) {
|
||||
do {
|
||||
let prev = this.get(index);
|
||||
if (prev && prev.linear) {
|
||||
return prev;
|
||||
}
|
||||
index -= 1;
|
||||
}
|
||||
} while (index > 0);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue