making sure pace caret doesnt show up if its not going to move

This commit is contained in:
Jack 2020-09-20 23:36:15 +01:00
parent b9be145c92
commit ea8250dee9
2 changed files with 6 additions and 3 deletions

View file

@ -915,7 +915,7 @@
</div>
<div id="testModesNotice"></div>
<div id="caret" class="default size15"></div>
<div id="paceCaret"></div>
<div id="paceCaret"class="default size15 hidden"></div>
<input id="wordsInput" class="" tabindex="0" autocomplete="off" />
<div id="timerNumber"><div>60</div></div>
<div id="miniTimerAndLiveWpm">

View file

@ -3526,7 +3526,6 @@ function playErrorSound() {
}
async function initPaceCaret() {
resetPaceCaret();
let mode2 = "";
if (config.mode === "time") {
@ -3551,10 +3550,13 @@ async function initPaceCaret() {
wpm = parseInt($(".pageSettings .section.paceCaret input.customPaceCaretSpeed").val());
}
if (wpm < 1 || wpm == false || wpm == undefined) {
if (wpm < 1 || wpm == false || wpm == undefined || wpm.isNaN()) {
config.paceCaret = "off";
return;
}
resetPaceCaret();
let characters = wpm * 5;
let cps = characters / 60; //characters per step
@ -3657,6 +3659,7 @@ function movePaceCaret() {
}
function resetPaceCaret() {
if (config.paceCaret === "off") return;
if (!$("#paceCaret").hasClass("hidden")) {
$("#paceCaret").addClass("hidden");
}