mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-29 16:46:08 +03:00
Add option to define the fillStyle of the placeholder
This commit is contained in:
parent
50e46b104e
commit
4523454ff1
@ -288,13 +288,13 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
|
|||||||
},
|
},
|
||||||
|
|
||||||
// private
|
// private
|
||||||
drawPlaceholder: function(rect) {
|
drawPlaceholder: function(rect, fillStyle) {
|
||||||
if (!this.useCanvas) {
|
if (!this.useCanvas) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.context.fillStyle = fillStyle || "#FFFFFF";
|
||||||
this.context.fillRect(rect.x, rect.y, rect.width, rect.height);
|
this.context.fillRect(rect.x, rect.y, rect.width, rect.height);
|
||||||
this.context.fillStyle = "#000000";
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
@ -206,6 +206,9 @@
|
|||||||
* @property {Number} [opacity=1]
|
* @property {Number} [opacity=1]
|
||||||
* Opacity of the drawer (1=opaque, 0=transparent)
|
* Opacity of the drawer (1=opaque, 0=transparent)
|
||||||
*
|
*
|
||||||
|
* @property {String|Object} [placeholderFillStyle=null]
|
||||||
|
* Draws a colored rectangle behind the tile if it is not loaded yet.
|
||||||
|
*
|
||||||
* @property {Number} [degrees=0]
|
* @property {Number} [degrees=0]
|
||||||
* Initial rotation.
|
* Initial rotation.
|
||||||
*
|
*
|
||||||
@ -1017,6 +1020,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
|
|
||||||
// APPEARANCE
|
// APPEARANCE
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
|
placeholderFillStyle: null,
|
||||||
|
|
||||||
//REFERENCE STRIP SETTINGS
|
//REFERENCE STRIP SETTINGS
|
||||||
showReferenceStrip: false,
|
showReferenceStrip: false,
|
||||||
|
@ -65,6 +65,7 @@
|
|||||||
* @param {Boolean} [options.alwaysBlend] - See {@link OpenSeadragon.Options}.
|
* @param {Boolean} [options.alwaysBlend] - See {@link OpenSeadragon.Options}.
|
||||||
* @param {Number} [options.minPixelRatio] - See {@link OpenSeadragon.Options}.
|
* @param {Number} [options.minPixelRatio] - See {@link OpenSeadragon.Options}.
|
||||||
* @param {Boolean} [options.debugMode] - See {@link OpenSeadragon.Options}.
|
* @param {Boolean} [options.debugMode] - See {@link OpenSeadragon.Options}.
|
||||||
|
* @param {String|Object} [options.placeholderFillStyle] - See {@link OpenSeadragon.Options}.
|
||||||
* @param {String|Boolean} [options.crossOriginPolicy] - See {@link OpenSeadragon.Options}.
|
* @param {String|Boolean} [options.crossOriginPolicy] - See {@link OpenSeadragon.Options}.
|
||||||
*/
|
*/
|
||||||
$.TiledImage = function( options ) {
|
$.TiledImage = function( options ) {
|
||||||
@ -140,7 +141,8 @@ $.TiledImage = function( options ) {
|
|||||||
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
|
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
|
||||||
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
|
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
|
||||||
debugMode: $.DEFAULT_SETTINGS.debugMode,
|
debugMode: $.DEFAULT_SETTINGS.debugMode,
|
||||||
crossOriginPolicy: $.DEFAULT_SETTINGS.crossOriginPolicy
|
crossOriginPolicy: $.DEFAULT_SETTINGS.crossOriginPolicy,
|
||||||
|
placeholderFillStyle: $.DEFAULT_SETTINGS.placeholderFillStyle
|
||||||
|
|
||||||
}, options );
|
}, options );
|
||||||
|
|
||||||
@ -1148,7 +1150,7 @@ function compareTiles( previousBest, tile ) {
|
|||||||
return previousBest;
|
return previousBest;
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawTiles( tiledImage, lastDrawn ){
|
function drawTiles( tiledImage, lastDrawn ) {
|
||||||
var i,
|
var i,
|
||||||
tile,
|
tile,
|
||||||
tileKey,
|
tileKey,
|
||||||
@ -1180,11 +1182,11 @@ function drawTiles( tiledImage, lastDrawn ){
|
|||||||
needsRestore = true;
|
needsRestore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( lastDrawn.length === 0 ) {
|
if ( tiledImage.placeholderFillStyle && lastDrawn.length === 0 ) {
|
||||||
tiledImage._drawer.saveContext();
|
tiledImage._drawer.saveContext();
|
||||||
var placeholderRect = boxToDrawerRectangle( tiledImage.getBounds(true) );
|
var placeholderRect = boxToDrawerRectangle( tiledImage.getBounds(true) );
|
||||||
|
|
||||||
tiledImage._drawer.drawPlaceholder(placeholderRect);
|
tiledImage._drawer.drawPlaceholder(placeholderRect, tiledImage.placeholderFillStyle);
|
||||||
needsRestore = true;
|
needsRestore = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1294,7 +1294,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
alwaysBlend: _this.alwaysBlend,
|
alwaysBlend: _this.alwaysBlend,
|
||||||
minPixelRatio: _this.minPixelRatio,
|
minPixelRatio: _this.minPixelRatio,
|
||||||
crossOriginPolicy: _this.crossOriginPolicy,
|
crossOriginPolicy: _this.crossOriginPolicy,
|
||||||
debugMode: _this.debugMode
|
debugMode: _this.debugMode,
|
||||||
|
placeholderFillStyle: _this.placeholderFillStyle
|
||||||
});
|
});
|
||||||
|
|
||||||
_this.world.addItem( tiledImage, {
|
_this.world.addItem( tiledImage, {
|
||||||
|
Loading…
Reference in New Issue
Block a user