Skip to content

Commit

Permalink
When tiles have overlap, rendering cropped tiles could throw an error.
Browse files Browse the repository at this point in the history
This happened on IE11.  By ensuring we don't ask to crop to a size
larger than the image, it works properly.
  • Loading branch information
manthey committed Aug 21, 2018
1 parent b3f521b commit 3b2ca7d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/canvas/quadFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,11 @@ var canvas_quadFeature = function (arg) {
if (!quad.crop) {
context2d.drawImage(src, 0, 0);
} else {
context2d.drawImage(src, 0, 0, quad.crop.x, quad.crop.y, 0, 0,
quad.crop.x, quad.crop.y);
var cropx = Math.min(src.w, quad.crop.x),
cropy = Math.min(src.h, quad.crop.y);
if (cropx > 0 && cropy > 0) {
context2d.drawImage(src, 0, 0, cropx, cropy, 0, 0, cropx, cropy);
}
}
});
});
Expand Down

0 comments on commit 3b2ca7d

Please sign in to comment.