mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Fix not being able to jump to the very end of the book
This commit is contained in:
@@ -90,6 +90,8 @@ export class SectionProgress {
|
|||||||
// the inverse of `getProgress`
|
// the inverse of `getProgress`
|
||||||
// get index of and fraction in section based on total fraction
|
// get index of and fraction in section based on total fraction
|
||||||
getSection(fraction) {
|
getSection(fraction) {
|
||||||
|
if (fraction === 0) return [0, 0]
|
||||||
|
if (fraction === 1) return [this.sizes.length - 1, 1]
|
||||||
const { sizes, sizeTotal } = this
|
const { sizes, sizeTotal } = this
|
||||||
const target = fraction * sizeTotal
|
const target = fraction * sizeTotal
|
||||||
let index = -1
|
let index = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user