mirror of
https://github.com/futurepress/epub.js.git
synced 2025-10-03 14:59:18 +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() {
|
first() {
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
while (index < this.spineItems.length-1) {
|
do {
|
||||||
let next = this.get(index);
|
let next = this.get(index);
|
||||||
if (next && next.linear) {
|
if (next && next.linear) {
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
index += 1;
|
index += 1;
|
||||||
}
|
} while (index < this.spineItems.length-1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
last() {
|
last() {
|
||||||
let index = this.spineItems.length-1;
|
let index = this.spineItems.length-1;
|
||||||
|
|
||||||
while (index > 0) {
|
do {
|
||||||
let prev = this.get(index);
|
let prev = this.get(index);
|
||||||
if (prev && prev.linear) {
|
if (prev && prev.linear) {
|
||||||
return prev;
|
return prev;
|
||||||
}
|
}
|
||||||
index -= 1;
|
index -= 1;
|
||||||
}
|
} while (index > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue