Skip to content

Commit

Permalink
Merge pull request #901 from OpenGeoscience/quad-crop-issue
Browse files Browse the repository at this point in the history
When tiles have overlap, rendering cropped tiles could throw an error.
  • Loading branch information
manthey authored Aug 21, 2018
2 parents b3f521b + 3b2ca7d commit 95c1e62
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 95c1e62

Please sign in to comment.