From d951497c3036df8ad17148d7c674172264136db0 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Sat, 29 Apr 2023 01:39:22 +0800 Subject: [PATCH] Fix not being able to jump to the very end of the book --- progress.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/progress.js b/progress.js index 2982204..55f918b 100644 --- a/progress.js +++ b/progress.js @@ -90,6 +90,8 @@ export class SectionProgress { // the inverse of `getProgress` // get index of and fraction in section based on total fraction getSection(fraction) { + if (fraction === 0) return [0, 0] + if (fraction === 1) return [this.sizes.length - 1, 1] const { sizes, sizeTotal } = this const target = fraction * sizeTotal let index = -1