add minPixelRatio guard back in; fix tabs and spaces in comments'

This commit is contained in:
Tom 2024-05-31 16:24:04 -04:00
parent f7c12a716b
commit 65d30e7ce1

View File

@ -72,8 +72,8 @@
* @param {Boolean} [options.iOSDevice] - See {@link OpenSeadragon.Options}.
* @param {Number} [options.opacity=1] - Set to draw at proportional opacity. If zero, images will not draw.
* @param {Boolean} [options.preload=false] - Set true to load even when the image is hidden by zero opacity.
* @param {String} [options.compositeOperation] - How the image is composited onto other images; see compositeOperation in {@link OpenSeadragon.Options} for possible
values.
* @param {String} [options.compositeOperation] - How the image is composited onto other images;
* see compositeOperation in {@link OpenSeadragon.Options} for possible values.
* @param {Boolean} [options.debugMode] - See {@link OpenSeadragon.Options}.
* @param {String|CanvasGradient|CanvasPattern|Function} [options.placeholderFillStyle] - See {@link OpenSeadragon.Options}.
* @param {String|Boolean} [options.crossOriginPolicy] - See {@link OpenSeadragon.Options}.
@ -1359,6 +1359,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
// We are iterating from highest resolution to lowest resolution
// Once a level fully covers the viewport the loop is halted and
// lower-resolution levels are skipped
let useLevel = false;
for (let i = 0; i < levelList.length; i++) {
let level = levelList[i];
@ -1367,6 +1368,14 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
true
).x * this._scaleSpring.current.value;
// make sure we skip levels until currentRenderPixelRatio becomes >= minPixelRatio
// but always use the last level in the list so we draw something
if (i === levelList.length - 1 || currentRenderPixelRatio >= this.minPixelRatio ) {
useLevel = true;
} else if (!useLevel) {
continue;
}
var targetRenderPixelRatio = this.viewport.deltaPixelsFromPointsNoRotate(
this.source.getPixelRatio(level),
false