From 5ee78502885db3a974e709ef4954aa82446ebd26 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 21 Sep 2020 00:46:28 +0100 Subject: [PATCH] fixed pace caret being on the wrong line --- public/js/script.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index 54195c56c..f8f6ade81 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -3643,9 +3643,12 @@ function movePaceCaret() { let smoothlinescroll = $("#words .smoothScroller").height(); if (smoothlinescroll === undefined) smoothlinescroll = 0; + $("#paceCaret").css({ + top: newTop - smoothlinescroll, + }); + caret.stop(true, true).animate( { - top: newTop - smoothlinescroll, left: newLeft, }, duration, @@ -3653,6 +3656,7 @@ function movePaceCaret() { ); } catch (e) { // $("#paceCaret").animate({ opacity: 0 }, 250, () => { + console.error(e); $("#paceCaret").addClass("hidden"); // }); } @@ -4349,6 +4353,9 @@ $(document).keydown((event) => { $("#words .smoothScroller").remove(); } ); + $("#paceCaret").animate({ + top: document.querySelector("#paceCaret").offsetTop - wordHeight, + },125); $("#words").animate( { marginTop: `-${wordHeight}px`, @@ -4367,8 +4374,10 @@ $(document).keydown((event) => { } else { toHide.forEach((el) => el.remove()); currentWordElementIndex -= toHide.length; + $("#paceCaret").css({ + top: document.querySelector("#paceCaret").offsetTop - wordHeight, + }); } - // if (config.smoothLineScroll) { // let word = $(document.querySelector(".word")); // $("#words").prepend(