From 9531bdd01c4748b7db8a231db58fc659e6ce7b18 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 7 Sep 2022 22:19:58 +0800 Subject: [PATCH] :rotating_light: --- app/src/asset/renderAssets.ts | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/app/src/asset/renderAssets.ts b/app/src/asset/renderAssets.ts index 16f1a45df..4d4726f84 100644 --- a/app/src/asset/renderAssets.ts +++ b/app/src/asset/renderAssets.ts @@ -19,21 +19,24 @@ export const renderAssetsPreview = (pathString: string) => { }; export const pdfResize = () => { - getAllModels().asset.find(item => { - const pdfInstance = item.pdfObject - const {pdfDocument, pdfViewer} = pdfInstance - if (!pdfDocument) { - return + getAllModels().asset.forEach(item => { + const pdfInstance = item.pdfObject; + if (!pdfInstance) { + return; } - const currentScaleValue = pdfViewer.currentScaleValue + const {pdfDocument, pdfViewer} = pdfInstance; + if (!pdfDocument) { + return; + } + const currentScaleValue = pdfViewer.currentScaleValue; if ( - currentScaleValue === 'auto' || - currentScaleValue === 'page-fit' || - currentScaleValue === 'page-width' + currentScaleValue === "auto" || + currentScaleValue === "page-fit" || + currentScaleValue === "page-width" ) { // Note: the scale is constant for 'page-actual'. - pdfViewer.currentScaleValue = currentScaleValue + pdfViewer.currentScaleValue = currentScaleValue; } - pdfViewer.update() - }) -} + pdfViewer.update(); + }); +};