Skip to content

Commit

Permalink
Respect img height/width in addImage api
Browse files Browse the repository at this point in the history
When the user passes an image tag with a height and width
that differ from the native height and width of the src,
mapbox should respect the user's choice and draw the scaled
image.
  • Loading branch information
AndyMoreland authored and jfirebaugh committed Apr 3, 2017
1 parent 879929a commit 5d0a8b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exports.getImageData = function (img) {
const context = canvas.getContext('2d');
canvas.width = img.width;
canvas.height = img.height;
context.drawImage(img, 0, 0);
context.drawImage(img, 0, 0, img.width, img.height);
return context.getImageData(0, 0, img.width, img.height).data;
};

Expand Down

0 comments on commit 5d0a8b7

Please sign in to comment.