mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +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
|
||||
drawPlaceholder: function(rect) {
|
||||
drawPlaceholder: function(rect, fillStyle) {
|
||||
if (!this.useCanvas) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.context.fillStyle = fillStyle || "#FFFFFF";
|
||||
this.context.fillRect(rect.x, rect.y, rect.width, rect.height);
|
||||
this.context.fillStyle = "#000000";
|
||||
},
|
||||
|
||||
// private
|
||||
|
@ -206,6 +206,9 @@
|
||||
* @property {Number} [opacity=1]
|
||||
* 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]
|
||||
* Initial rotation.
|
||||
*
|
||||
@ -1017,6 +1020,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
||||
|
||||
// APPEARANCE
|
||||
opacity: 1,
|
||||
placeholderFillStyle: null,
|
||||
|
||||
//REFERENCE STRIP SETTINGS
|
||||
showReferenceStrip: false,
|
||||
|
@ -65,6 +65,7 @@
|
||||
* @param {Boolean} [options.alwaysBlend] - See {@link OpenSeadragon.Options}.
|
||||
* @param {Number} [options.minPixelRatio] - 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}.
|
||||
*/
|
||||
$.TiledImage = function( options ) {
|
||||
@ -140,7 +141,8 @@ $.TiledImage = function( options ) {
|
||||
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
|
||||
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
|
||||
debugMode: $.DEFAULT_SETTINGS.debugMode,
|
||||
crossOriginPolicy: $.DEFAULT_SETTINGS.crossOriginPolicy
|
||||
crossOriginPolicy: $.DEFAULT_SETTINGS.crossOriginPolicy,
|
||||
placeholderFillStyle: $.DEFAULT_SETTINGS.placeholderFillStyle
|
||||
|
||||
}, options );
|
||||
|
||||
@ -1180,11 +1182,11 @@ function drawTiles( tiledImage, lastDrawn ){
|
||||
needsRestore = true;
|
||||
}
|
||||
|
||||
if ( lastDrawn.length === 0 ) {
|
||||
if ( tiledImage.placeholderFillStyle && lastDrawn.length === 0 ) {
|
||||
tiledImage._drawer.saveContext();
|
||||
var placeholderRect = boxToDrawerRectangle( tiledImage.getBounds(true) );
|
||||
|
||||
tiledImage._drawer.drawPlaceholder(placeholderRect);
|
||||
tiledImage._drawer.drawPlaceholder(placeholderRect, tiledImage.placeholderFillStyle);
|
||||
needsRestore = true;
|
||||
}
|
||||
|
||||
|
@ -1294,7 +1294,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
alwaysBlend: _this.alwaysBlend,
|
||||
minPixelRatio: _this.minPixelRatio,
|
||||
crossOriginPolicy: _this.crossOriginPolicy,
|
||||
debugMode: _this.debugMode
|
||||
debugMode: _this.debugMode,
|
||||
placeholderFillStyle: _this.placeholderFillStyle
|
||||
});
|
||||
|
||||
_this.world.addItem( tiledImage, {
|
||||
|
Loading…
Reference in New Issue
Block a user