Only update the max-height of the SecondaryToolbar when it's actually visible

There's really no good reason to attempt to adjust the `max-height` of the `SecondaryToolbar` when it's not visible, so let's not do that anymore.
Also, we can listen for the `resize` event in `SecondaryToolbar`, to avoid having to manually call the `max-height` adjust function from various event handlers in `app.js`. Please note that by always adjusting the `max-height` when the toolbar is opened we no longer need the `localized` event, since it was mainly used to set a correct inital `max-height` value.
This commit is contained in:
Jonas Jenwald 2016-09-08 12:35:49 +02:00
parent ca61ccc533
commit 6e126b31dc
3 changed files with 30 additions and 22 deletions

View file

@ -270,7 +270,7 @@ var PDFViewerApplication = {
new PDFDocumentProperties(appConfig.documentProperties);
this.secondaryToolbar =
new SecondaryToolbar(appConfig.secondaryToolbar, eventBus);
new SecondaryToolbar(appConfig.secondaryToolbar, container, eventBus);
if (this.supportsFullscreen) {
this.pdfPresentationMode = new PDFPresentationMode({
@ -1807,10 +1807,6 @@ function webViewerResize() {
}
PDFViewerApplication.pdfViewer.update();
}
// Set the 'max-height' CSS property of the secondary toolbar.
var mainContainer = PDFViewerApplication.appConfig.mainContainer;
PDFViewerApplication.secondaryToolbar.setMaxHeight(mainContainer);
}
window.addEventListener('hashchange', function webViewerHashchange(evt) {
@ -1894,10 +1890,6 @@ function webViewerLocalized() {
container.setAttribute('style', 'min-width: ' + width + 'px; ' +
'max-width: ' + width + 'px;');
}
// Set the 'max-height' CSS property of the secondary toolbar.
var mainContainer = PDFViewerApplication.appConfig.mainContainer;
PDFViewerApplication.secondaryToolbar.setMaxHeight(mainContainer);
});
}