From 32ff8db241d42e7effc94ebaca01e9124644a5f4 Mon Sep 17 00:00:00 2001 From: Ajay Date: Thu, 18 Aug 2022 02:39:56 -0400 Subject: [PATCH] Fix buffering sometimes not rendering all the way --- src/js-components/previewBar.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js-components/previewBar.ts b/src/js-components/previewBar.ts index 890cedf2..f456f19c 100644 --- a/src/js-components/previewBar.ts +++ b/src/js-components/previewBar.ts @@ -561,8 +561,8 @@ class PreviewBar { let scalePosition = 0; let scaleWidth = 0; - for (const sectionElement of sections) { - const section = sectionElement as HTMLElement; + for (let i = 0; i < sections.length; i++) { + const section = sections[i] as HTMLElement; const checkElement = section.querySelector(selector) as HTMLElement; const currentSectionWidthNoMargin = this.getPartialChapterSectionStyle(section, "width") || progressBar.clientWidth; const currentSectionWidth = currentSectionWidthNoMargin @@ -579,7 +579,7 @@ class PreviewBar { const transformMatch = checkElement.style.transform.match(/scaleX\(([0-9.]+?)\)/); if (transformMatch) { const transformScale = parseFloat(transformMatch[1]); - if (transformScale < 1 && transformScale + checkLeft / currentSectionWidthNoMargin < 0.99999) { + if (i === sections.length - 1 || (transformScale < 1 && transformScale + checkLeft / currentSectionWidthNoMargin < 0.99999)) { scale = transformScale; scaleWidth = currentSectionWidthNoMargin;