1
0
Fork 0
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:
Anatoly Smolyaninov 2017-09-26 20:56:07 +07:00
parent 3397c41a6b
commit ce8dc1e4ba

View file

@ -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() {