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:
parent
e2e9657ed0
commit
4b9d0a67d2
@ -538,20 +538,16 @@ class BaseViewer {
|
|||||||
throw new Error('Not implemented: _scrollIntoView');
|
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) {
|
_setScaleUpdatePages(newScale, newValue, noScroll = false, preset = false) {
|
||||||
this._currentScaleValue = newValue.toString();
|
this._currentScaleValue = newValue.toString();
|
||||||
|
|
||||||
if (isSameScale(this._currentScale, newScale)) {
|
if (isSameScale(this._currentScale, newScale)) {
|
||||||
if (preset) {
|
if (preset) {
|
||||||
this._setScaleDispatchEvent(newScale, newValue, true);
|
this.eventBus.dispatch('scalechanging', {
|
||||||
|
source: this,
|
||||||
|
scale: newScale,
|
||||||
|
presetValue: newValue,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return;
|
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) {
|
if (this.defaultRenderingQueue) {
|
||||||
this.update();
|
this.update();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user