Merge pull request #1429 from openseadragon/ig-square

Fixed issue with square tile code on IE
This commit is contained in:
Ian Gilman 2018-04-25 09:35:11 -07:00 committed by GitHub
commit ceb828dd06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -367,16 +367,21 @@ $.Tile.prototype = {
// changes as we are rendering the image // changes as we are rendering the image
drawingHandler({context: context, tile: this, rendered: rendered}); drawingHandler({context: context, tile: this, rendered: rendered});
if (!this.sourceBounds) { // Just in case var sourceWidth, sourceHeight;
this.sourceBounds = new $.Rect(0, 0, rendered.canvas.width, rendered.canvas.height); if (this.sourceBounds) {
sourceWidth = Math.min(this.sourceBounds.width, rendered.canvas.width);
sourceHeight = Math.min(this.sourceBounds.height, rendered.canvas.height);
} else {
sourceWidth = rendered.canvas.width;
sourceHeight = rendered.canvas.height;
} }
context.drawImage( context.drawImage(
rendered.canvas, rendered.canvas,
this.sourceBounds.x, 0,
this.sourceBounds.y, 0,
this.sourceBounds.width, sourceWidth,
this.sourceBounds.height, sourceHeight,
position.x, position.x,
position.y, position.y,
size.x, size.x,

View File

@ -392,9 +392,7 @@ $.TileSource.prototype = {
sy = Math.min( sy, dimensionsScaled.y - py ); sy = Math.min( sy, dimensionsScaled.y - py );
if (isSource) { if (isSource) {
scale = 1; return new $.Rect(0, 0, sx, sy);
px = 0;
py = 0;
} }
return new $.Rect( px * scale, py * scale, sx * scale, sy * scale ); return new $.Rect( px * scale, py * scale, sx * scale, sy * scale );