Fix not being able to jump to the very end of the book

This commit is contained in:
John Factotum
2023-04-29 01:39:22 +08:00
parent 649ffa93b8
commit d951497c30
+2
View File
@@ -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