Add zoom options to View menu

Fixes #2138
This commit is contained in:
Martynas Bagdonas 2021-08-05 11:27:54 +03:00
parent bd56b16247
commit a065d477ed
6 changed files with 67 additions and 1 deletions

View file

@ -133,6 +133,29 @@
type="checkbox"
oncommand="menuCmd('switchspreadmode_even')"
/>
<menuseparator class="menu-type-reader"/>
<menuitem
id="view-menuitem-zoom-in"
label="&zotero.pdfReader.zoomIn;"
oncommand="menuCmd('zoomIn')"
/>
<menuitem
id="view-menuitem-zoom-out"
label="&zotero.pdfReader.zoomOut;"
oncommand="menuCmd('zoomOut')"
/>
<menuitem
id="view-menuitem-zoom-auto"
type="checkbox"
label="&zotero.pdfReader.zoomAuto;"
oncommand="menuCmd('zoomAuto')"
/>
<menuitem
id="view-menuitem-zoom-page-width"
type="checkbox"
label="&zotero.pdfReader.zoomPageWidth;"
oncommand="menuCmd('zoomPageWidth')"
/>
</menupopup>
</menu>
<menu

View file

@ -356,6 +356,8 @@ const ZoteroStandalone = new function() {
this.updateMenuItemCheckmark('view-menuitem-odd-spreads', state.spreadMode == 1);
this.updateMenuItemCheckmark('view-menuitem-even-spreads', state.spreadMode == 2);
this.updateMenuItemCheckmark('view-menuitem-hand-tool', reader.isHandToolActive());
this.updateMenuItemCheckmark('view-menuitem-zoom-auto', reader.isZoomAutoActive());
this.updateMenuItemCheckmark('view-menuitem-zoom-page-width', reader.isZoomPageWidthActive());
}
// Layout mode

View file

@ -286,6 +286,33 @@
oncommand="ZoteroStandalone.onReaderCmd('switchspreadmode_even')"
/>
<menuseparator class="menu-type-reader"/>
<menuitem
id="view-menuitem-zoom-in"
class="menu-type-reader"
label="&zotero.pdfReader.zoomIn;"
oncommand="ZoteroStandalone.onReaderCmd('zoomIn')"
/>
<menuitem
id="view-menuitem-zoom-out"
class="menu-type-reader"
label="&zotero.pdfReader.zoomOut;"
oncommand="ZoteroStandalone.onReaderCmd('zoomOut')"
/>
<menuitem
id="view-menuitem-zoom-auto"
class="menu-type-reader"
type="checkbox"
label="&zotero.pdfReader.zoomAuto;"
oncommand="ZoteroStandalone.onReaderCmd('zoomAuto')"
/>
<menuitem
id="view-menuitem-zoom-page-width"
class="menu-type-reader"
type="checkbox"
label="&zotero.pdfReader.zoomPageWidth;"
oncommand="ZoteroStandalone.onReaderCmd('zoomPageWidth')"
/>
<menuseparator class="menu-type-reader"/>
<menu id="layout-menu" label="&layout.label;">
<menupopup oncommand="ZoteroStandalone.onViewMenuItemClick(event)">

View file

@ -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() {

View file

@ -349,3 +349,7 @@
<!ENTITY zotero.pdfReader.noSpreads "No Spreads">
<!ENTITY zotero.pdfReader.oddSpreads "Odd Spreads">
<!ENTITY zotero.pdfReader.evenSpreads "Even Spreads">
<!ENTITY zotero.pdfReader.zoomIn "Zoom In">
<!ENTITY zotero.pdfReader.zoomOut "Zoom Out">
<!ENTITY zotero.pdfReader.zoomAuto "Automatically Resize">
<!ENTITY zotero.pdfReader.zoomPageWidth "Zoom to Page Width">

@ -1 +1 @@
Subproject commit 5ae72ff6a24cc756e71da20b7b9a21c3092c8160
Subproject commit 06cef9ac89dbd51ecaed311dcc06f74f5e3d82d0