fix: draw the level based on pixel density ratio

This commit is contained in:
ronnymikalsen 2021-02-04 12:24:01 +01:00
parent a3d91fe237
commit 39811d9300
2 changed files with 9 additions and 2 deletions

View File

@ -1018,7 +1018,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
);
var currentZeroRatio = this.viewport.deltaPixelsFromPointsNoRotate(
this.source.getPixelRatio(0), true).x *
this._scaleSpring.current.value;
this._scaleSpring.current.value * $.pixelDensityRatio;
var highestLevel = Math.min(
Math.abs(this.source.maxLevel),
Math.abs(Math.floor(
@ -1082,7 +1082,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
var currentRenderPixelRatio = viewport.deltaPixelsFromPointsNoRotate(
this.source.getPixelRatio(level),
true
).x * this._scaleSpring.current.value;
).x * this._scaleSpring.current.value * $.pixelDensityRatio;
if (level === lowestLevel ||
(!haveDrawn && currentRenderPixelRatio >= this.minPixelRatio)) {

View File

@ -401,6 +401,13 @@ $.Viewer = function( options ) {
debugGridColor: this.debugGridColor
});
function resize() {
console.log("Windows is resized...");
_this.world.resetItems();
_this.forceRedraw();
}
$.addEvent( window, 'resize', resize );
// Overlay container
this.overlaysContainer = $.makeNeutralElement( "div" );
this.canvas.appendChild( this.overlaysContainer );