setPreload correctly treats both Primatives and Objects as Boolean Primatives

This commit is contained in:
thejohnhoffer 2017-05-30 12:00:43 -05:00
parent cf5825d1fa
commit 7a4fda37b5
2 changed files with 5 additions and 5 deletions

View File

@ -295,7 +295,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
* Draws the TiledImage to its Drawer.
*/
draw: function() {
if (!(this.opacity === 0 && !this._preload)) {
if (this.opacity !== 0 || this._preload) {
this._midDraw = true;
this._updateViewport();
this._midDraw = false;
@ -773,7 +773,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
},
/**
* @returns {Boolean} whether the tiledImage can load hidden tiles of zero opacity.
* @returns {Boolean} whether the tiledImage can load its tiles even when it has zero opacity.
*/
getPreload: function() {
return this._preload;
@ -783,7 +783,7 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
* Set true to load even when hidden. Set false to block loading when hidden.
*/
setPreload: function(preload) {
this._preload = !!preload;
this._preload = new Boolean(preload).valueOf();
this._needsDraw = true;
},
@ -1536,7 +1536,7 @@ function compareTiles( previousBest, tile ) {
}
function drawTiles( tiledImage, lastDrawn ) {
if (this.opacity === 0 || lastDrawn.length === 0) {
if (tiledImage.opacity === 0 || lastDrawn.length === 0) {
return;
}
var tile = lastDrawn[0];

View File

@ -1227,7 +1227,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
* @param {OpenSeadragon.Rect} [options.clip] - An area, in image pixels, to clip to
* (portions of the image outside of this area will not be visible). Only works on
* browsers that support the HTML5 canvas.
* @param {Number} [options.opacity=1] Default proportional opacity of the tiled images (1=opaque, 0=hidden)
* @param {Number} [options.opacity=1] Proportional opacity of the tiled images (1=opaque, 0=hidden)
* @param {Boolean} [options.preload=false] Default switch for loading hidden images (true loads, false blocks)
* @param {Number} [options.degrees=0] Initial rotation of the tiled image around
* its top left corner in degrees.