Skip to content

Commit

Permalink
Fix #4093 Scale value can be number or string
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Yu committed Dec 13, 2023
1 parent 8f5cbca commit 9512080
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion viewer/latexworkshop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 9512080

Please sign in to comment.