mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-19 17:21:50 +03:00
Fix drawer.clear
This commit is contained in:
parent
9d053c545b
commit
dd07771415
@ -240,7 +240,7 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
|
||||
/**
|
||||
* Clears the Drawer so it's ready to draw another frame.
|
||||
*/
|
||||
clear: function( useSketch ) {
|
||||
clear: function() {
|
||||
this.canvas.innerHTML = "";
|
||||
if ( this.useCanvas ) {
|
||||
var viewportSize = this._calculateCanvasSize();
|
||||
@ -253,11 +253,19 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
|
||||
this.sketchCanvas.height = this.canvas.height;
|
||||
}
|
||||
}
|
||||
this._getContext( useSketch ).clearRect(
|
||||
0, 0, viewportSize.x, viewportSize.y );
|
||||
this._clear();
|
||||
}
|
||||
},
|
||||
|
||||
_clear: function ( useSketch ) {
|
||||
if ( !this.useCanvas ) {
|
||||
return;
|
||||
}
|
||||
var context = this._getContext( useSketch );
|
||||
var canvas = context.canvas;
|
||||
context.clearRect( 0, 0, canvas.width, canvas.height );
|
||||
},
|
||||
|
||||
/**
|
||||
* Translates from OpenSeadragon viewer rectangle to drawer rectangle.
|
||||
* @param {OpenSeadragon.Rect} rectangle - The rectangle in viewport coordinate system.
|
||||
|
@ -497,12 +497,10 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
|
||||
/**
|
||||
* @param {Number} opacity Opacity the tiled image should be drawn at.
|
||||
* @returns {OpenSeadragon.TiledImage} Chainable
|
||||
*/
|
||||
setOpacity: function(opacity) {
|
||||
this.opacity = opacity;
|
||||
this._needsDraw = true;
|
||||
return this;
|
||||
},
|
||||
|
||||
// private
|
||||
@ -1178,6 +1176,9 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
return;
|
||||
}
|
||||
var useSketch = tiledImage.opacity < 1;
|
||||
if ( useSketch ) {
|
||||
tiledImage._drawer._clear( true );
|
||||
}
|
||||
|
||||
var usedClip = false;
|
||||
if ( tiledImage._clip ) {
|
||||
@ -1234,7 +1235,6 @@ function drawTiles( tiledImage, lastDrawn ) {
|
||||
|
||||
if ( useSketch ) {
|
||||
tiledImage._drawer.blendSketch( tiledImage.opacity );
|
||||
tiledImage._drawer.clear( true );
|
||||
}
|
||||
drawDebugInfo( tiledImage, lastDrawn );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user