Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with resizing the zoom box width - follow-up of #2816 #3258

Merged
merged 1 commit into from
Jun 3, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ var MIN_SCALE = 0.25;
var MAX_SCALE = 4.0;
var SETTINGS_MEMORY = 20;
var HISTORY_DISABLED = false;
var SCALE_SELECT_CONTAINER_PADDING = 8;
var SCALE_SELECT_PADDING = 22;
var RenderingStates = {
INITIAL: 0,
RUNNING: 1,
Expand Down Expand Up @@ -3729,15 +3731,19 @@ window.addEventListener('localized', function localized(evt) {
document.getElementsByTagName('html')[0].dir = mozL10n.getDirection();

// Adjust the width of the zoom box to fit the content.
PDFView.animationStartedPromise.then(
function() {
var container = document.getElementById('scaleSelectContainer');
// Note: This is only done if the zoom box is actually visible,
// since otherwise element.clientWidth will return 0.
PDFView.animationStartedPromise.then(function() {
var container = document.getElementById('scaleSelectContainer');
if (container.clientWidth > 0) {
var select = document.getElementById('scaleSelect');
select.setAttribute('style', 'min-width: inherit;');
var width = select.clientWidth + 8;
select.setAttribute('style', 'min-width: ' + (width + 20) + 'px;');
var width = select.clientWidth + SCALE_SELECT_CONTAINER_PADDING;
select.setAttribute('style', 'min-width: ' +
(width + SCALE_SELECT_PADDING) + 'px;');
container.setAttribute('style', 'min-width: ' + width + 'px; ' +
'max-width: ' + width + 'px;');
}
});
}, true);

Expand Down