From a065d477ed2e02e65b6d783a6a8d89b6d49ac0d8 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Thu, 5 Aug 2021 11:27:54 +0300 Subject: [PATCH] Add zoom options to View menu Fixes #2138 --- chrome/content/zotero/reader.xul | 23 ++++++++++++++++ .../content/zotero/standalone/standalone.js | 2 ++ .../content/zotero/standalone/standalone.xul | 27 +++++++++++++++++++ chrome/content/zotero/xpcom/reader.js | 10 +++++++ chrome/locale/en-US/zotero/zotero.dtd | 4 +++ pdf-reader | 2 +- 6 files changed, 67 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/reader.xul b/chrome/content/zotero/reader.xul index 47f30446ce..400aa2d7ee 100644 --- a/chrome/content/zotero/reader.xul +++ b/chrome/content/zotero/reader.xul @@ -133,6 +133,29 @@ type="checkbox" oncommand="menuCmd('switchspreadmode_even')" /> + + + + + + + + + + diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 91c6b6a681..467033ad37 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -153,6 +153,14 @@ class ReaderInstance { return this._iframeWindow.eval('PDFViewerApplication.pdfCursorTools.handTool.active'); } + isZoomAutoActive() { + return this._iframeWindow.eval('PDFViewerApplication.pdfViewer.currentScaleValue === "auto"'); + } + + isZoomPageWidthActive() { + return this._iframeWindow.eval('PDFViewerApplication.pdfViewer.currentScaleValue === "page-width"'); + } + allowNavigateFirstPage() { return this._iframeWindow.eval('PDFViewerApplication.pdfViewer.currentPageNumber > 1'); } @@ -768,6 +776,8 @@ class ReaderWindow extends ReaderInstance { this._window.document.getElementById('view-menuitem-odd-spreads').setAttribute('checked', this.state.spreadMode == 1); this._window.document.getElementById('view-menuitem-even-spreads').setAttribute('checked', this.state.spreadMode == 2); this._window.document.getElementById('view-menuitem-hand-tool').setAttribute('checked', this.isHandToolActive()); + this._window.document.getElementById('view-menuitem-zoom-auto').setAttribute('checked', this.isZoomAutoActive()); + this._window.document.getElementById('view-menuitem-zoom-page-width').setAttribute('checked', this.isZoomPageWidthActive()); } _onGoMenuOpen() { diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd index 10f39853b6..a661ca1efe 100644 --- a/chrome/locale/en-US/zotero/zotero.dtd +++ b/chrome/locale/en-US/zotero/zotero.dtd @@ -349,3 +349,7 @@ + + + + diff --git a/pdf-reader b/pdf-reader index 5ae72ff6a2..06cef9ac89 160000 --- a/pdf-reader +++ b/pdf-reader @@ -1 +1 @@ -Subproject commit 5ae72ff6a24cc756e71da20b7b9a21c3092c8160 +Subproject commit 06cef9ac89dbd51ecaed311dcc06f74f5e3d82d0