mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-11 18:03:30 +08:00
parent
f7dbeb63a6
commit
0cc21739a8
1 changed files with 19 additions and 15 deletions
|
@ -105,28 +105,32 @@ export async function updatePosition(): Promise<void> {
|
|||
(fullWidthCaret ? 0 : caretWidth / 2);
|
||||
}
|
||||
}
|
||||
const newWidth = fullWidthCaret
|
||||
? ((currentLetter
|
||||
? currentLetter.offsetWidth
|
||||
: previousLetter.offsetWidth) ?? 0) + "px"
|
||||
: "";
|
||||
|
||||
let smoothlinescroll = $("#words .smoothScroller").height();
|
||||
if (smoothlinescroll === undefined) smoothlinescroll = 0;
|
||||
|
||||
if (Config.smoothCaret) {
|
||||
caret.stop(true, false).animate(
|
||||
{
|
||||
top: newTop - smoothlinescroll,
|
||||
left: newLeft,
|
||||
},
|
||||
SlowTimer.get() ? 0 : 100
|
||||
);
|
||||
caret.css("display", "block"); //for some goddamn reason adding width animation sets the display to none ????????
|
||||
|
||||
const animation: { top: number; left: number; width?: string } = {
|
||||
top: newTop - smoothlinescroll,
|
||||
left: newLeft,
|
||||
};
|
||||
|
||||
if (newWidth !== "") {
|
||||
animation["width"] = newWidth;
|
||||
} else {
|
||||
caret.stop(true, true).animate(
|
||||
{
|
||||
top: newTop - smoothlinescroll,
|
||||
left: newLeft,
|
||||
},
|
||||
0
|
||||
);
|
||||
caret.css("width", "");
|
||||
}
|
||||
|
||||
caret
|
||||
.stop(true, false)
|
||||
.animate(animation, Config.smoothCaret && !SlowTimer.get() ? 100 : 0);
|
||||
|
||||
if (Config.showAllLines) {
|
||||
const browserHeight = window.innerHeight;
|
||||
const middlePos =
|
||||
|
|
Loading…
Reference in a new issue