refactor: moved methods that belongs together closer

This commit is contained in:
ronnymikalsen 2021-03-26 12:38:58 +01:00
parent 47802c0bd7
commit 3fcd4aeee3

View File

@ -1613,21 +1613,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
return this.world.removeItem(drawer); return this.world.removeItem(drawer);
}, },
/**
* Update pixel density ratio, clears all tiles and triggers updates for
* all items if the ratio has changed.
* @private
*/
_updatePixelDensityRatio: function() {
var previusPixelDensityRatio = $.pixelDensityRatio;
var currentPixelDensityRatio = $.getCurrentPixelDensityRatio();
if (previusPixelDensityRatio !== currentPixelDensityRatio) {
$.pixelDensityRatio = currentPixelDensityRatio;
this.world.resetItems();
this.forceRedraw();
}
},
/** /**
* Force the viewer to redraw its contents. * Force the viewer to redraw its contents.
* @returns {OpenSeadragon.Viewer} Chainable. * @returns {OpenSeadragon.Viewer} Chainable.
@ -2303,6 +2288,21 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
*/ */
_removeUpdatePixelDensityRatioEvent: function() { _removeUpdatePixelDensityRatioEvent: function() {
$.removeEvent( window, 'resize', this._updatePixelDensityRatioBind ); $.removeEvent( window, 'resize', this._updatePixelDensityRatioBind );
},
/**
* Update pixel density ratio, clears all tiles and triggers updates for
* all items if the ratio has changed.
* @private
*/
_updatePixelDensityRatio: function() {
var previusPixelDensityRatio = $.pixelDensityRatio;
var currentPixelDensityRatio = $.getCurrentPixelDensityRatio();
if (previusPixelDensityRatio !== currentPixelDensityRatio) {
$.pixelDensityRatio = currentPixelDensityRatio;
this.world.resetItems();
this.forceRedraw();
}
} }
}); });