Removes circular dependency of secondary toolbar on app.js.
This commit is contained in:
parent
61a4c740d2
commit
eb3d1ca003
92
web/app.js
92
web/app.js
@ -262,32 +262,21 @@ var PDFViewerApplication = {
|
|||||||
this.handTool = new HandTool({
|
this.handTool = new HandTool({
|
||||||
container: container,
|
container: container,
|
||||||
eventBus: this.eventBus,
|
eventBus: this.eventBus,
|
||||||
toggleHandTool: appConfig.secondaryToolbar.toggleHandTool
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.pdfDocumentProperties =
|
this.pdfDocumentProperties =
|
||||||
new PDFDocumentProperties(appConfig.documentProperties);
|
new PDFDocumentProperties(appConfig.documentProperties);
|
||||||
|
|
||||||
SecondaryToolbar.initialize(appConfig.secondaryToolbar);
|
SecondaryToolbar.initialize(appConfig.secondaryToolbar, eventBus);
|
||||||
this.secondaryToolbar = SecondaryToolbar;
|
this.secondaryToolbar = SecondaryToolbar;
|
||||||
|
|
||||||
if (this.supportsFullscreen) {
|
if (this.supportsFullscreen) {
|
||||||
var toolbar = SecondaryToolbar;
|
|
||||||
this.pdfPresentationMode = new PDFPresentationMode({
|
this.pdfPresentationMode = new PDFPresentationMode({
|
||||||
container: container,
|
container: container,
|
||||||
viewer: viewer,
|
viewer: viewer,
|
||||||
pdfViewer: this.pdfViewer,
|
pdfViewer: this.pdfViewer,
|
||||||
eventBus: this.eventBus,
|
eventBus: this.eventBus,
|
||||||
contextMenuItems: [
|
contextMenuItems: appConfig.fullscreen
|
||||||
{ element: appConfig.fullscreen.contextFirstPage,
|
|
||||||
handler: toolbar.firstPageClick.bind(toolbar) },
|
|
||||||
{ element: appConfig.fullscreen.contextLastPage,
|
|
||||||
handler: toolbar.lastPageClick.bind(toolbar) },
|
|
||||||
{ element: appConfig.fullscreen.contextPageRotateCw,
|
|
||||||
handler: toolbar.pageRotateCwClick.bind(toolbar) },
|
|
||||||
{ element: appConfig.fullscreen.contextPageRotateCcw,
|
|
||||||
handler: toolbar.pageRotateCcwClick.bind(toolbar) }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1248,6 +1237,15 @@ var PDFViewerApplication = {
|
|||||||
eventBus.on('pagemode', webViewerPageMode);
|
eventBus.on('pagemode', webViewerPageMode);
|
||||||
eventBus.on('namedaction', webViewerNamedAction);
|
eventBus.on('namedaction', webViewerNamedAction);
|
||||||
eventBus.on('presentationmodechanged', webViewerPresentationModeChanged);
|
eventBus.on('presentationmodechanged', webViewerPresentationModeChanged);
|
||||||
|
eventBus.on('presentationmode', webViewerPresentationMode);
|
||||||
|
eventBus.on('openfile', webViewerOpenFile);
|
||||||
|
eventBus.on('print', webViewerPrint);
|
||||||
|
eventBus.on('download', webViewerDownload);
|
||||||
|
eventBus.on('firstpage', webViewerFirstPage);
|
||||||
|
eventBus.on('lastpage', webViewerLastPage);
|
||||||
|
eventBus.on('rotatecw', webViewerRotateCw);
|
||||||
|
eventBus.on('rotateccw', webViewerRotateCcw);
|
||||||
|
eventBus.on('documentproperties', webViewerDocumentProperties);
|
||||||
eventBus.on('find', webViewerFind);
|
eventBus.on('find', webViewerFind);
|
||||||
//#if GENERIC
|
//#if GENERIC
|
||||||
eventBus.on('fileinputchange', webViewerFileInputChange);
|
eventBus.on('fileinputchange', webViewerFileInputChange);
|
||||||
@ -1477,16 +1475,22 @@ function webViewerInitialized() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
appConfig.toolbar.presentationModeButton.addEventListener('click',
|
appConfig.toolbar.presentationModeButton.addEventListener('click',
|
||||||
SecondaryToolbar.presentationModeClick.bind(SecondaryToolbar));
|
function (e) {
|
||||||
|
PDFViewerApplication.eventBus.dispatch('presentationmode');
|
||||||
|
|
||||||
appConfig.toolbar.openFile.addEventListener('click',
|
});
|
||||||
SecondaryToolbar.openFileClick.bind(SecondaryToolbar));
|
|
||||||
|
|
||||||
appConfig.toolbar.print.addEventListener('click',
|
appConfig.toolbar.openFile.addEventListener('click', function (e) {
|
||||||
SecondaryToolbar.printClick.bind(SecondaryToolbar));
|
PDFViewerApplication.eventBus.dispatch('openfile');
|
||||||
|
});
|
||||||
|
|
||||||
appConfig.toolbar.download.addEventListener('click',
|
appConfig.toolbar.print.addEventListener('click', function (e) {
|
||||||
SecondaryToolbar.downloadClick.bind(SecondaryToolbar));
|
PDFViewerApplication.eventBus.dispatch('print');
|
||||||
|
});
|
||||||
|
|
||||||
|
appConfig.toolbar.download.addEventListener('click', function (e) {
|
||||||
|
PDFViewerApplication.eventBus.dispatch('download');
|
||||||
|
});
|
||||||
|
|
||||||
//#if (FIREFOX || MOZCENTRAL || CHROME)
|
//#if (FIREFOX || MOZCENTRAL || CHROME)
|
||||||
//PDFViewerApplication.setTitleUsingUrl(file);
|
//PDFViewerApplication.setTitleUsingUrl(file);
|
||||||
@ -1827,6 +1831,39 @@ function webViewerLocalized() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function webViewerPresentationMode() {
|
||||||
|
PDFViewerApplication.requestPresentationMode();
|
||||||
|
}
|
||||||
|
function webViewerOpenFile() {
|
||||||
|
var openFileInputName = PDFViewerApplication.appConfig.openFileInputName;
|
||||||
|
document.getElementById(openFileInputName).click();
|
||||||
|
}
|
||||||
|
function webViewerPrint() {
|
||||||
|
window.print();
|
||||||
|
}
|
||||||
|
function webViewerDownload() {
|
||||||
|
PDFViewerApplication.download();
|
||||||
|
}
|
||||||
|
function webViewerFirstPage() {
|
||||||
|
if (PDFViewerApplication.pdfDocument) {
|
||||||
|
PDFViewerApplication.page = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function webViewerLastPage() {
|
||||||
|
if (PDFViewerApplication.pdfDocument) {
|
||||||
|
PDFViewerApplication.page = PDFViewerApplication.pagesCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function webViewerRotateCw() {
|
||||||
|
PDFViewerApplication.rotatePages(90);
|
||||||
|
}
|
||||||
|
function webViewerRotateCcw() {
|
||||||
|
PDFViewerApplication.rotatePages(-90);
|
||||||
|
}
|
||||||
|
function webViewerDocumentProperties() {
|
||||||
|
PDFViewerApplication.pdfDocumentProperties.open();
|
||||||
|
}
|
||||||
|
|
||||||
function webViewerFind(e) {
|
function webViewerFind(e) {
|
||||||
PDFViewerApplication.findController.executeCommand('find' + e.type, {
|
PDFViewerApplication.findController.executeCommand('find' + e.type, {
|
||||||
query: e.query,
|
query: e.query,
|
||||||
@ -1937,11 +1974,16 @@ window.addEventListener('DOMMouseScroll', handleMouseWheel);
|
|||||||
window.addEventListener('mousewheel', handleMouseWheel);
|
window.addEventListener('mousewheel', handleMouseWheel);
|
||||||
|
|
||||||
window.addEventListener('click', function click(evt) {
|
window.addEventListener('click', function click(evt) {
|
||||||
if (SecondaryToolbar.opened &&
|
if (!SecondaryToolbar.opened) {
|
||||||
PDFViewerApplication.pdfViewer.containsElement(evt.target)) {
|
return;
|
||||||
|
}
|
||||||
|
var appConfig = PDFViewerApplication.appConfig;
|
||||||
|
if (PDFViewerApplication.pdfViewer.containsElement(evt.target) ||
|
||||||
|
(appConfig.toolbar.container.contains(evt.target) &&
|
||||||
|
evt.target !== appConfig.secondaryToolbar.toggleButton)) {
|
||||||
SecondaryToolbar.close();
|
SecondaryToolbar.close();
|
||||||
}
|
}
|
||||||
}, false);
|
}, true);
|
||||||
|
|
||||||
window.addEventListener('keydown', function keydown(evt) {
|
window.addEventListener('keydown', function keydown(evt) {
|
||||||
if (OverlayManager.active) {
|
if (OverlayManager.active) {
|
||||||
@ -2214,8 +2256,4 @@ window.addEventListener('afterprint', function afterPrint(evt) {
|
|||||||
|
|
||||||
exports.PDFViewerApplication = PDFViewerApplication;
|
exports.PDFViewerApplication = PDFViewerApplication;
|
||||||
exports.DefaultExernalServices = DefaultExernalServices;
|
exports.DefaultExernalServices = DefaultExernalServices;
|
||||||
|
|
||||||
//// TODO remove circular reference of pdfjs-web/secondary_toolbar on app.
|
|
||||||
secondaryToolbarLib._setApp(exports);
|
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
@ -17,29 +17,22 @@
|
|||||||
|
|
||||||
(function (root, factory) {
|
(function (root, factory) {
|
||||||
if (typeof define === 'function' && define.amd) {
|
if (typeof define === 'function' && define.amd) {
|
||||||
define('pdfjs-web/hand_tool', ['exports', 'pdfjs-web/ui_utils',
|
define('pdfjs-web/hand_tool', ['exports', 'pdfjs-web/grab_to_pan',
|
||||||
'pdfjs-web/grab_to_pan', 'pdfjs-web/preferences',
|
'pdfjs-web/preferences'], factory);
|
||||||
'pdfjs-web/secondary_toolbar'], factory);
|
|
||||||
} else if (typeof exports !== 'undefined') {
|
} else if (typeof exports !== 'undefined') {
|
||||||
factory(exports, require('./ui_utils.js'), require('./grab_to_pan.js'),
|
factory(exports, require('./grab_to_pan.js'), require('./preferences.js'));
|
||||||
require('./preferences.js'), require('./secondary_toolbar.js'));
|
|
||||||
} else {
|
} else {
|
||||||
factory((root.pdfjsWebHandTool = {}), root.pdfjsWebUIUtils,
|
factory((root.pdfjsWebHandTool = {}), root.pdfjsWebGrabToPan,
|
||||||
root.pdfjsWebGrabToPan, root.pdfjsWebPreferences,
|
root.pdfjsWebPreferences);
|
||||||
root.pdfjsWebSecondaryToolbar);
|
|
||||||
}
|
}
|
||||||
}(this, function (exports, uiUtils, grabToPan, preferences, secondaryToolbar) {
|
}(this, function (exports, grabToPan, preferences) {
|
||||||
|
|
||||||
var mozL10n = uiUtils.mozL10n;
|
|
||||||
var GrabToPan = grabToPan.GrabToPan;
|
var GrabToPan = grabToPan.GrabToPan;
|
||||||
var Preferences = preferences.Preferences;
|
var Preferences = preferences.Preferences;
|
||||||
var SecondaryToolbar = secondaryToolbar.SecondaryToolbar;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {Object} HandToolOptions
|
* @typedef {Object} HandToolOptions
|
||||||
* @property {HTMLDivElement} container - The document container.
|
* @property {HTMLDivElement} container - The document container.
|
||||||
* @property {HTMLButtonElement} toggleHandTool - The button element for
|
|
||||||
* toggling the hand tool.
|
|
||||||
* @property {EventBus} eventBus - The application event bus.
|
* @property {EventBus} eventBus - The application event bus.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -54,32 +47,17 @@ var HandTool = (function HandToolClosure() {
|
|||||||
function HandTool(options) {
|
function HandTool(options) {
|
||||||
this.container = options.container;
|
this.container = options.container;
|
||||||
this.eventBus = options.eventBus;
|
this.eventBus = options.eventBus;
|
||||||
this.toggleHandTool = options.toggleHandTool;
|
|
||||||
|
|
||||||
this.wasActive = false;
|
this.wasActive = false;
|
||||||
|
|
||||||
this.handTool = new GrabToPan({
|
this.handTool = new GrabToPan({
|
||||||
element: this.container,
|
element: this.container,
|
||||||
onActiveChanged: function(isActive) {
|
onActiveChanged: function(isActive) {
|
||||||
if (!this.toggleHandTool) {
|
this.eventBus.dispatch('handtoolchanged', {isActive: isActive});
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isActive) {
|
|
||||||
this.toggleHandTool.title =
|
|
||||||
mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
|
|
||||||
this.toggleHandTool.firstElementChild.textContent =
|
|
||||||
mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool');
|
|
||||||
} else {
|
|
||||||
this.toggleHandTool.title =
|
|
||||||
mozL10n.get('hand_tool_enable.title', null, 'Enable hand tool');
|
|
||||||
this.toggleHandTool.firstElementChild.textContent =
|
|
||||||
mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
|
|
||||||
}
|
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.toggleHandTool) {
|
this.eventBus.on('togglehandtool', this.toggle.bind(this));
|
||||||
this.toggleHandTool.addEventListener('click', this.toggle.bind(this));
|
|
||||||
|
|
||||||
this.eventBus.on('localized', function (e) {
|
this.eventBus.on('localized', function (e) {
|
||||||
Preferences.get('enableHandToolOnLoad').then(function resolved(value) {
|
Preferences.get('enableHandToolOnLoad').then(function resolved(value) {
|
||||||
@ -100,7 +78,6 @@ var HandTool = (function HandToolClosure() {
|
|||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
HandTool.prototype = {
|
HandTool.prototype = {
|
||||||
/**
|
/**
|
||||||
@ -112,7 +89,6 @@ var HandTool = (function HandToolClosure() {
|
|||||||
|
|
||||||
toggle: function HandTool_toggle() {
|
toggle: function HandTool_toggle() {
|
||||||
this.handTool.toggle();
|
this.handTool.toggle();
|
||||||
SecondaryToolbar.close();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
enterPresentationMode: function HandTool_enterPresentationMode() {
|
enterPresentationMode: function HandTool_enterPresentationMode() {
|
||||||
|
@ -62,13 +62,26 @@ var PDFPresentationMode = (function PDFPresentationModeClosure() {
|
|||||||
this.mouseScrollDelta = 0;
|
this.mouseScrollDelta = 0;
|
||||||
|
|
||||||
if (contextMenuItems) {
|
if (contextMenuItems) {
|
||||||
for (var i = 0, ii = contextMenuItems.length; i < ii; i++) {
|
contextMenuItems.contextFirstPage.addEventListener('click',
|
||||||
var item = contextMenuItems[i];
|
function PDFPresentationMode_contextFirstPageClick(e) {
|
||||||
item.element.addEventListener('click', function (handler) {
|
|
||||||
this.contextMenuOpen = false;
|
this.contextMenuOpen = false;
|
||||||
handler();
|
this.eventBus.dispatch('firstpage');
|
||||||
}.bind(this, item.handler));
|
}.bind(this));
|
||||||
}
|
contextMenuItems.contextLastPage.addEventListener('click',
|
||||||
|
function PDFPresentationMode_contextLastPageClick(e) {
|
||||||
|
this.contextMenuOpen = false;
|
||||||
|
this.eventBus.dispatch('lastpage');
|
||||||
|
}.bind(this));
|
||||||
|
contextMenuItems.contextPageRotateCw.addEventListener('click',
|
||||||
|
function PDFPresentationMode_contextPageRotateCwClick(e) {
|
||||||
|
this.contextMenuOpen = false;
|
||||||
|
this.eventBus.dispatch('rotatecw');
|
||||||
|
}.bind(this));
|
||||||
|
contextMenuItems.contextPageRotateCcw.addEventListener('click',
|
||||||
|
function PDFPresentationMode_contextPageRotateCcwClick(e) {
|
||||||
|
this.contextMenuOpen = false;
|
||||||
|
this.eventBus.dispatch('rotateccw');
|
||||||
|
}.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,16 +27,15 @@
|
|||||||
}(this, function (exports, uiUtils) {
|
}(this, function (exports, uiUtils) {
|
||||||
|
|
||||||
var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
|
var SCROLLBAR_PADDING = uiUtils.SCROLLBAR_PADDING;
|
||||||
|
var mozL10n = uiUtils.mozL10n;
|
||||||
var app; // Avoiding circular reference, see _setApp function below.
|
|
||||||
var PDFViewerApplication = null; // = app.PDFViewerApplication;
|
|
||||||
|
|
||||||
var SecondaryToolbar = {
|
var SecondaryToolbar = {
|
||||||
opened: false,
|
opened: false,
|
||||||
previousContainerHeight: null,
|
previousContainerHeight: null,
|
||||||
newContainerHeight: null,
|
newContainerHeight: null,
|
||||||
|
|
||||||
initialize: function secondaryToolbarInitialize(options) {
|
initialize: function secondaryToolbarInitialize(options, eventBus) {
|
||||||
|
this.eventBus = eventBus;
|
||||||
this.toolbar = options.toolbar;
|
this.toolbar = options.toolbar;
|
||||||
this.buttonContainer = this.toolbar.firstElementChild;
|
this.buttonContainer = this.toolbar.firstElementChild;
|
||||||
|
|
||||||
@ -51,6 +50,7 @@ var SecondaryToolbar = {
|
|||||||
this.lastPage = options.lastPage;
|
this.lastPage = options.lastPage;
|
||||||
this.pageRotateCw = options.pageRotateCw;
|
this.pageRotateCw = options.pageRotateCw;
|
||||||
this.pageRotateCcw = options.pageRotateCcw;
|
this.pageRotateCcw = options.pageRotateCcw;
|
||||||
|
this.toggleHandTool = options.toggleHandTool;
|
||||||
this.documentPropertiesButton = options.documentPropertiesButton;
|
this.documentPropertiesButton = options.documentPropertiesButton;
|
||||||
|
|
||||||
// Attach the event listeners.
|
// Attach the event listeners.
|
||||||
@ -58,7 +58,6 @@ var SecondaryToolbar = {
|
|||||||
// Button to toggle the visibility of the secondary toolbar:
|
// Button to toggle the visibility of the secondary toolbar:
|
||||||
{ element: this.toggleButton, handler: this.toggle },
|
{ element: this.toggleButton, handler: this.toggle },
|
||||||
// All items within the secondary toolbar
|
// All items within the secondary toolbar
|
||||||
// (except for toggleHandTool, hand_tool.js is responsible for it):
|
|
||||||
{ element: this.presentationModeButton,
|
{ element: this.presentationModeButton,
|
||||||
handler: this.presentationModeClick },
|
handler: this.presentationModeClick },
|
||||||
{ element: this.openFile, handler: this.openFileClick },
|
{ element: this.openFile, handler: this.openFileClick },
|
||||||
@ -69,6 +68,7 @@ var SecondaryToolbar = {
|
|||||||
{ element: this.lastPage, handler: this.lastPageClick },
|
{ element: this.lastPage, handler: this.lastPageClick },
|
||||||
{ element: this.pageRotateCw, handler: this.pageRotateCwClick },
|
{ element: this.pageRotateCw, handler: this.pageRotateCwClick },
|
||||||
{ element: this.pageRotateCcw, handler: this.pageRotateCcwClick },
|
{ element: this.pageRotateCcw, handler: this.pageRotateCcwClick },
|
||||||
|
{ element: this.toggleHandTool, handler: this.toggleHandToolClick },
|
||||||
{ element: this.documentPropertiesButton,
|
{ element: this.documentPropertiesButton,
|
||||||
handler: this.documentPropertiesClick }
|
handler: this.documentPropertiesClick }
|
||||||
];
|
];
|
||||||
@ -79,27 +79,46 @@ var SecondaryToolbar = {
|
|||||||
element.addEventListener('click', elements[item].handler.bind(this));
|
element.addEventListener('click', elements[item].handler.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tracking hand tool menu item changes.
|
||||||
|
var isHandToolActive = false;
|
||||||
|
this.eventBus.on('handtoolchanged', function (e) {
|
||||||
|
if (isHandToolActive === e.isActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isHandToolActive = e.isActive;
|
||||||
|
if (isHandToolActive) {
|
||||||
|
this.toggleHandTool.title =
|
||||||
|
mozL10n.get('hand_tool_disable.title', null, 'Disable hand tool');
|
||||||
|
this.toggleHandTool.firstElementChild.textContent =
|
||||||
|
mozL10n.get('hand_tool_disable_label', null, 'Disable hand tool');
|
||||||
|
} else {
|
||||||
|
this.toggleHandTool.title =
|
||||||
|
mozL10n.get('hand_tool_enable.title', null, 'Enable hand tool');
|
||||||
|
this.toggleHandTool.firstElementChild.textContent =
|
||||||
|
mozL10n.get('hand_tool_enable_label', null, 'Enable hand tool');
|
||||||
|
}
|
||||||
|
}.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Event handling functions.
|
// Event handling functions.
|
||||||
presentationModeClick: function secondaryToolbarPresentationModeClick(evt) {
|
presentationModeClick: function secondaryToolbarPresentationModeClick(evt) {
|
||||||
PDFViewerApplication.requestPresentationMode();
|
this.eventBus.dispatch('presentationmode');
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
openFileClick: function secondaryToolbarOpenFileClick(evt) {
|
openFileClick: function secondaryToolbarOpenFileClick(evt) {
|
||||||
var openFileInputName = PDFViewerApplication.appConfig.openFileInputName;
|
this.eventBus.dispatch('openfile');
|
||||||
document.getElementById(openFileInputName).click();
|
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
printClick: function secondaryToolbarPrintClick(evt) {
|
printClick: function secondaryToolbarPrintClick(evt) {
|
||||||
window.print();
|
this.eventBus.dispatch('print');
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
downloadClick: function secondaryToolbarDownloadClick(evt) {
|
downloadClick: function secondaryToolbarDownloadClick(evt) {
|
||||||
PDFViewerApplication.download();
|
this.eventBus.dispatch('download');
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -108,27 +127,30 @@ var SecondaryToolbar = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
firstPageClick: function secondaryToolbarFirstPageClick(evt) {
|
firstPageClick: function secondaryToolbarFirstPageClick(evt) {
|
||||||
PDFViewerApplication.page = 1;
|
this.eventBus.dispatch('firstpage');
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
lastPageClick: function secondaryToolbarLastPageClick(evt) {
|
lastPageClick: function secondaryToolbarLastPageClick(evt) {
|
||||||
if (PDFViewerApplication.pdfDocument) {
|
this.eventBus.dispatch('lastpage');
|
||||||
PDFViewerApplication.page = PDFViewerApplication.pagesCount;
|
|
||||||
}
|
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) {
|
pageRotateCwClick: function secondaryToolbarPageRotateCwClick(evt) {
|
||||||
PDFViewerApplication.rotatePages(90);
|
this.eventBus.dispatch('rotatecw');
|
||||||
},
|
},
|
||||||
|
|
||||||
pageRotateCcwClick: function secondaryToolbarPageRotateCcwClick(evt) {
|
pageRotateCcwClick: function secondaryToolbarPageRotateCcwClick(evt) {
|
||||||
PDFViewerApplication.rotatePages(-90);
|
this.eventBus.dispatch('rotateccw');
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleHandToolClick: function secondaryToolbarToggleHandToolClick(evt) {
|
||||||
|
this.eventBus.dispatch('togglehandtool');
|
||||||
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
documentPropertiesClick: function secondaryToolbarDocumentPropsClick(evt) {
|
documentPropertiesClick: function secondaryToolbarDocumentPropsClick(evt) {
|
||||||
PDFViewerApplication.pdfDocumentProperties.open();
|
this.eventBus.dispatch('documentproperties');
|
||||||
this.close();
|
this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -175,11 +197,5 @@ var SecondaryToolbar = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function _setApp(app_) {
|
|
||||||
app = app_;
|
|
||||||
PDFViewerApplication = app.PDFViewerApplication;
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.SecondaryToolbar = SecondaryToolbar;
|
exports.SecondaryToolbar = SecondaryToolbar;
|
||||||
exports._setApp = _setApp;
|
|
||||||
}));
|
}));
|
||||||
|
@ -57,6 +57,7 @@ function getViewerConfiguration() {
|
|||||||
viewerContainer: document.getElementById('viewer'),
|
viewerContainer: document.getElementById('viewer'),
|
||||||
eventBus: null, // using global event bus with DOM events
|
eventBus: null, // using global event bus with DOM events
|
||||||
toolbar: {
|
toolbar: {
|
||||||
|
container: document.getElementById('toolbarViewer'),
|
||||||
numPages: document.getElementById('numPages'),
|
numPages: document.getElementById('numPages'),
|
||||||
pageNumber: document.getElementById('pageNumber'),
|
pageNumber: document.getElementById('pageNumber'),
|
||||||
scaleSelectContainer: document.getElementById('scaleSelectContainer'),
|
scaleSelectContainer: document.getElementById('scaleSelectContainer'),
|
||||||
|
Loading…
Reference in New Issue
Block a user