From a45bba353b8b6a4f35882c71a0e12ed71ad5b634 Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 22 Sep 2020 14:03:23 +0100 Subject: [PATCH] the pace caret will not animate if smooth caret is disabled --- public/js/script.js | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/public/js/script.js b/public/js/script.js index defe51485..f67e7cd7c 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -3746,16 +3746,31 @@ function movePaceCaret() { top: newTop - smoothlinescroll, }); - caret.stop(true, true).animate( - { - left: newLeft, - }, - paceCaret.spc * 1000, - "linear", - () => { + let duration = paceCaret.spc * 1000; + + if (config.smoothCaret) { + caret.stop(true, true).animate( + { + left: newLeft, + }, + duration, + "linear", + () => { + movePaceCaret(); + } + ); + } else { + caret.stop(true, true).animate( + { + left: newLeft, + }, + 0, + "linear" + ) + setTimeout(() => { movePaceCaret(); - } - ); + },duration) + } } catch (e) { // $("#paceCaret").animate({ opacity: 0 }, 250, () => { console.error(e);