From 951208076f537a62c430670dfca9c302d857a4e7 Mon Sep 17 00:00:00 2001 From: James Yu Date: Wed, 13 Dec 2023 12:09:43 +0000 Subject: [PATCH] Fix #4093 Scale value can be number or string --- viewer/latexworkshop.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/viewer/latexworkshop.ts b/viewer/latexworkshop.ts index 802736864..6044990dd 100644 --- a/viewer/latexworkshop.ts +++ b/viewer/latexworkshop.ts @@ -248,6 +248,7 @@ class LateXWorkshopPdfViewer implements ILatexWorkshopPdfViewer { private async restorePdfViewerState(state: PdfViewerState) { await this.pdfViewerStarted + // By setting the scale, scaling will be invoked if necessary. // The scale can be a non-number one. if (state.scale !== undefined) { @@ -393,7 +394,7 @@ class LateXWorkshopPdfViewer implements ILatexWorkshopPdfViewer { if (pack.sidebarView) { PDFViewerApplication.pdfSidebar.switchView(pack.sidebarView) } - if (typeof pack.scale === 'number' && PDFViewerApplication.pdfViewer.currentScaleValue !== pack.scale) { + if (['number', 'string'].includes(typeof pack.scale) && PDFViewerApplication.pdfViewer.currentScaleValue !== pack.scale) { PDFViewerApplication.pdfViewer.currentScaleValue = pack.scale } if (typeof pack.scrollMode === 'number' && PDFViewerApplication.pdfViewer.scrollMode !== pack.scrollMode) {