Fix regression that prevents resetting the zoom level to "Automatic" when using the |Ctrl + 0| keys

This commit is contained in:
Jonas Jenwald 2015-02-19 17:30:47 +01:00
parent 6bb0a483b1
commit a495ab0d13

View File

@ -335,12 +335,27 @@ var PDFViewer = (function pdfViewer() {
} }
}, },
_setScaleDispatchEvent: function pdfViewer_setScaleDispatchEvent(
newScale, newValue, preset) {
var event = document.createEvent('UIEvents');
event.initUIEvent('scalechange', true, true, window, 0);
event.scale = newScale;
if (preset) {
event.presetValue = newValue;
}
this.container.dispatchEvent(event);
},
_setScaleUpdatePages: function pdfViewer_setScaleUpdatePages( _setScaleUpdatePages: function pdfViewer_setScaleUpdatePages(
newScale, newValue, noScroll, preset) { newScale, newValue, noScroll, preset) {
this._currentScaleValue = newValue; this._currentScaleValue = newValue;
if (newScale === this._currentScale) { if (newScale === this._currentScale) {
if (preset) {
this._setScaleDispatchEvent(newScale, newValue, true);
}
return; return;
} }
for (var i = 0, ii = this.pages.length; i < ii; i++) { for (var i = 0, ii = this.pages.length; i < ii; i++) {
this.pages[i].update(newScale); this.pages[i].update(newScale);
} }
@ -360,13 +375,7 @@ var PDFViewer = (function pdfViewer() {
this.scrollPageIntoView(page, dest); this.scrollPageIntoView(page, dest);
} }
var event = document.createEvent('UIEvents'); this._setScaleDispatchEvent(newScale, newValue, preset);
event.initUIEvent('scalechange', true, true, window, 0);
event.scale = newScale;
if (preset) {
event.presetValue = newValue;
}
this.container.dispatchEvent(event);
}, },
_setScale: function pdfViewer_setScale(value, noScroll) { _setScale: function pdfViewer_setScale(value, noScroll) {