From 3b2ca7d15ae4313102a70315e657f0e05db8b977 Mon Sep 17 00:00:00 2001 From: David Manthey Date: Tue, 21 Aug 2018 09:29:22 -0400 Subject: [PATCH] When tiles have overlap, rendering cropped tiles could throw an error. This happened on IE11. By ensuring we don't ask to crop to a size larger than the image, it works properly. --- src/canvas/quadFeature.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/canvas/quadFeature.js b/src/canvas/quadFeature.js index 37fd20e89e..fa8c07e522 100644 --- a/src/canvas/quadFeature.js +++ b/src/canvas/quadFeature.js @@ -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); + } } }); });