From 4221e54390960826c0353e9f235f62ec996aa231 Mon Sep 17 00:00:00 2001 From: Abdo Date: Mon, 24 Jun 2024 10:48:49 +0300 Subject: [PATCH] Fix image occlusion flicker caused by setupI18n() (#3253) --- ts/routes/image-occlusion/review.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ts/routes/image-occlusion/review.ts b/ts/routes/image-occlusion/review.ts index 129a7de89..3be8af7fa 100644 --- a/ts/routes/image-occlusion/review.ts +++ b/ts/routes/image-occlusion/review.ts @@ -44,11 +44,6 @@ interface SetupImageOcclusionOptions { async function setupImageOcclusion(setupOptions?: SetupImageOcclusionOptions): Promise { await waitForImage(); - await setupI18n({ - modules: [ - ModuleName.NOTETYPES, - ], - }); window.addEventListener("load", () => { window.addEventListener("resize", () => setupImageOcclusion(setupOptions)); }); @@ -120,7 +115,7 @@ function calculateContainerSize( let oneTimeSetupDone = false; -function setupImageOcclusionInner(setupOptions?: SetupImageOcclusionOptions): void { +async function setupImageOcclusionInner(setupOptions?: SetupImageOcclusionOptions): Promise { const canvas = document.querySelector( "#image-occlusion-canvas", ) as HTMLCanvasElement | null; @@ -135,6 +130,11 @@ function setupImageOcclusionInner(setupOptions?: SetupImageOcclusionOptions): vo "#image-occlusion-container img", ) as HTMLImageElement; if (image == null) { + await setupI18n({ + modules: [ + ModuleName.NOTETYPES, + ], + }); container.innerText = tr.notetypeErrorNoImageToShow(); return; }