Inline the 'scalechanging' event dispatching in BaseViewer._setScaleUpdatePages

With only *one* event now being dispatched when the scale changes, in combination with there only being two call-sites, it doesn't seem necessary to keep the helper method for dispatching the 'scalechanging' event.
This commit is contained in:
Jonas Jenwald 2018-09-20 23:27:10 +02:00
parent e2e9657ed0
commit 4b9d0a67d2

View File

@ -538,20 +538,16 @@ class BaseViewer {
throw new Error('Not implemented: _scrollIntoView');
}
_setScaleDispatchEvent(newScale, newValue, preset = false) {
this.eventBus.dispatch('scalechanging', {
source: this,
scale: newScale,
presetValue: preset ? newValue : undefined,
});
}
_setScaleUpdatePages(newScale, newValue, noScroll = false, preset = false) {
this._currentScaleValue = newValue.toString();
if (isSameScale(this._currentScale, newScale)) {
if (preset) {
this._setScaleDispatchEvent(newScale, newValue, true);
this.eventBus.dispatch('scalechanging', {
source: this,
scale: newScale,
presetValue: newValue,
});
}
return;
}
@ -576,7 +572,11 @@ class BaseViewer {
});
}
this._setScaleDispatchEvent(newScale, newValue, preset);
this.eventBus.dispatch('scalechanging', {
source: this,
scale: newScale,
presetValue: preset ? newValue : undefined,
});
if (this.defaultRenderingQueue) {
this.update();