From 47802c0bd75e45493e60d1778060d2607f5f1148 Mon Sep 17 00:00:00 2001 From: ronnymikalsen Date: Fri, 26 Mar 2021 12:08:50 +0100 Subject: [PATCH] refactor: use pixelDensityRatio in getPixelRatio() --- src/tiledimage.js | 4 ++-- src/tilesource.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tiledimage.js b/src/tiledimage.js index ccc51601..74ffacef 100644 --- a/src/tiledimage.js +++ b/src/tiledimage.js @@ -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 * $.pixelDensityRatio; + this._scaleSpring.current.value; 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 * $.pixelDensityRatio; + ).x * this._scaleSpring.current.value; if (level === lowestLevel || (!haveDrawn && currentRenderPixelRatio >= this.minPixelRatio)) { diff --git a/src/tilesource.js b/src/tilesource.js index fcf2be82..aab7f134 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -313,8 +313,8 @@ $.TileSource.prototype = { */ getPixelRatio: function( level ) { var imageSizeScaled = this.dimensions.times( this.getLevelScale( level ) ), - rx = 1.0 / imageSizeScaled.x, - ry = 1.0 / imageSizeScaled.y; + rx = 1.0 / imageSizeScaled.x * $.pixelDensityRatio, + ry = 1.0 / imageSizeScaled.y * $.pixelDensityRatio; return new $.Point(rx, ry); },