From ab4426dc7371877458c329a8229599d963e3f828 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 18 Mar 2023 20:59:26 -0700 Subject: [PATCH] psimage: load thumbnail Signed-off-by: Varun Patil --- src/components/viewer/PsImage.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/viewer/PsImage.ts b/src/components/viewer/PsImage.ts index a694d5fd..c91aaee5 100644 --- a/src/components/viewer/PsImage.ts +++ b/src/components/viewer/PsImage.ts @@ -36,7 +36,13 @@ export default class ImageContentSetup { getXImgElem(content: any, onLoad: () => void): HTMLImageElement { const img = document.createElement("img"); img.classList.add("pswp__img", "ximg"); - img.style.visibility = "hidden"; + + // Load thumbnail in case the user is scrolling fast + if (content.data.msrc) { + img.src = content.data.msrc; + } else { + img.style.visibility = "hidden"; + } // Fetch with Axios fetchImage(content.data.src).then((blob) => {