mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Pass tiledImage and context to the placeholderFillStyle function
This commit is contained in:
parent
6b1580824a
commit
21d32b59f5
@ -310,16 +310,10 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
this.saveContext();
|
||||
if ( typeof fillStyle === "function" ) {
|
||||
this.context.fillStyle = fillStyle(this.context);
|
||||
}
|
||||
else {
|
||||
this.context.fillStyle = fillStyle;
|
||||
}
|
||||
this.context.save();
|
||||
this.context.fillStyle = fillStyle;
|
||||
this.context.fillRect(rect.x, rect.y, rect.width, rect.height);
|
||||
this.restoreContext();
|
||||
this.context.restore();
|
||||
},
|
||||
|
||||
// private
|
||||
|
@ -209,7 +209,7 @@
|
||||
* @property {String|CanvasGradient|CanvasPattern|Function} [placeholderFillStyle=null]
|
||||
* Draws a colored rectangle behind the tile if it is not loaded yet.
|
||||
* You can pass a CSS color value like "#FF8800".
|
||||
* When passing a function the canvas context is available as argument which is useful when you draw a gradient or pattern.
|
||||
* When passing a function the tiledImage and canvas context are available as argument which is useful when you draw a gradient or pattern.
|
||||
*
|
||||
* @property {Number} [degrees=0]
|
||||
* Initial rotation.
|
||||
|
@ -1172,7 +1172,16 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
|
||||
if ( tiledImage.placeholderFillStyle && lastDrawn.length === 0 ) {
|
||||
var placeholderRect = tiledImage._drawer.viewportToDrawerRectangle(tiledImage.getBounds(true));
|
||||
tiledImage._drawer.drawPlaceholder(placeholderRect, tiledImage.placeholderFillStyle);
|
||||
|
||||
var fillStyle = null;
|
||||
if ( typeof tiledImage.placeholderFillStyle === "function" ) {
|
||||
fillStyle = tiledImage.placeholderFillStyle(tiledImage, tiledImage._drawer.context);
|
||||
}
|
||||
else {
|
||||
fillStyle = tiledImage.placeholderFillStyle;
|
||||
}
|
||||
|
||||
tiledImage._drawer.drawPlaceholder(placeholderRect, fillStyle);
|
||||
}
|
||||
|
||||
for ( i = lastDrawn.length - 1; i >= 0; i-- ) {
|
||||
|
Loading…
Reference in New Issue
Block a user