|
@@ -2005,6 +2005,18 @@ var PDFViewer = (function pdfViewer() {
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function isSameScale(oldScale, newScale) {
|
|
|
|
+ if (newScale === oldScale) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ if (Math.abs(newScale - oldScale) < 1e-15) {
|
|
|
|
+ // Prevent unnecessary re-rendering of all pages when the scale
|
|
|
|
+ // changes only because of limited numerical precision.
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* @constructs PDFViewer
|
|
* @constructs PDFViewer
|
|
* @param {PDFViewerOptions} options
|
|
* @param {PDFViewerOptions} options
|
|
@@ -2298,7 +2310,8 @@ var PDFViewer = (function pdfViewer() {
|
|
_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 (isSameScale(this._currentScale, newScale)) {
|
|
if (preset) {
|
|
if (preset) {
|
|
this._setScaleDispatchEvent(newScale, newValue, true);
|
|
this._setScaleDispatchEvent(newScale, newValue, true);
|
|
}
|
|
}
|