mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
don't wait for images before revealing
Currently there's a nasty blink when revealing the answer if the answer has images on it, as the entire card is hidden, and not shown again until the images have loaded. This patch removes the wait, so text should appear more quickly, but it will mean the images may pop in. We still wait for images before scrolling, to avoid a scroll to the wrong location. There's plenty of scope to improve this further - preloading images, rendering MathJax in advance, etc, but those changes will need to wait for now. #1120 has some related discussion.
This commit is contained in:
parent
114eec6585
commit
8e5e277ee4
1 changed files with 1 additions and 5 deletions
|
@ -95,9 +95,6 @@ async function _updateQA(
|
|||
})
|
||||
.catch(renderError("MathJax"));
|
||||
|
||||
// defer display for up to 100ms to allow images to load
|
||||
await Promise.race([allImagesLoaded(), new Promise((r) => setTimeout(r, 100))]);
|
||||
|
||||
// and reveal card when processing is done
|
||||
qa.style.opacity = "1";
|
||||
await _runHook(onShownHook);
|
||||
|
@ -136,8 +133,7 @@ function _showAnswer(a: string, bodyclass: string): void {
|
|||
document.body.className = bodyclass;
|
||||
}
|
||||
|
||||
// avoid scrolling to the answer until images load, even if it
|
||||
// takes more than 100ms
|
||||
// avoid scrolling to the answer until images load
|
||||
allImagesLoaded().then(scrollToAnswer);
|
||||
},
|
||||
function () {}
|
||||
|
|
Loading…
Reference in a new issue