mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-20 01:31:45 +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.
|
* Clears the Drawer so it's ready to draw another frame.
|
||||||
*/
|
*/
|
||||||
clear: function( useSketch ) {
|
clear: function() {
|
||||||
this.canvas.innerHTML = "";
|
this.canvas.innerHTML = "";
|
||||||
if ( this.useCanvas ) {
|
if ( this.useCanvas ) {
|
||||||
var viewportSize = this._calculateCanvasSize();
|
var viewportSize = this._calculateCanvasSize();
|
||||||
@ -253,11 +253,19 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
|
|||||||
this.sketchCanvas.height = this.canvas.height;
|
this.sketchCanvas.height = this.canvas.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._getContext( useSketch ).clearRect(
|
this._clear();
|
||||||
0, 0, viewportSize.x, viewportSize.y );
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_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.
|
* Translates from OpenSeadragon viewer rectangle to drawer rectangle.
|
||||||
* @param {OpenSeadragon.Rect} rectangle - The rectangle in viewport coordinate system.
|
* @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.
|
* @param {Number} opacity Opacity the tiled image should be drawn at.
|
||||||
* @returns {OpenSeadragon.TiledImage} Chainable
|
|
||||||
*/
|
*/
|
||||||
setOpacity: function(opacity) {
|
setOpacity: function(opacity) {
|
||||||
this.opacity = opacity;
|
this.opacity = opacity;
|
||||||
this._needsDraw = true;
|
this._needsDraw = true;
|
||||||
return this;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// private
|
// private
|
||||||
@ -1178,6 +1176,9 @@ function drawTiles( tiledImage, lastDrawn ) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var useSketch = tiledImage.opacity < 1;
|
var useSketch = tiledImage.opacity < 1;
|
||||||
|
if ( useSketch ) {
|
||||||
|
tiledImage._drawer._clear( true );
|
||||||
|
}
|
||||||
|
|
||||||
var usedClip = false;
|
var usedClip = false;
|
||||||
if ( tiledImage._clip ) {
|
if ( tiledImage._clip ) {
|
||||||
@ -1234,7 +1235,6 @@ function drawTiles( tiledImage, lastDrawn ) {
|
|||||||
|
|
||||||
if ( useSketch ) {
|
if ( useSketch ) {
|
||||||
tiledImage._drawer.blendSketch( tiledImage.opacity );
|
tiledImage._drawer.blendSketch( tiledImage.opacity );
|
||||||
tiledImage._drawer.clear( true );
|
|
||||||
}
|
}
|
||||||
drawDebugInfo( tiledImage, lastDrawn );
|
drawDebugInfo( tiledImage, lastDrawn );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user