Added width + height arguments to ctx.drawImage

Previous functionality meant that images would be drawn at their source file size regardless of whether custom width or height properties were set.
This commit is contained in:
Jamie McElwain 2017-05-13 12:11:52 +01:00 committed by Evert Timberg
parent e45ac3c945
commit 0bbc3fa8f3

View File

@ -10,7 +10,7 @@ module.exports = function(Chart) {
if (typeof pointStyle === 'object') {
type = pointStyle.toString();
if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
ctx.drawImage(pointStyle, x - pointStyle.width / 2, y - pointStyle.height / 2);
ctx.drawImage(pointStyle, x - pointStyle.width / 2, y - pointStyle.height / 2, pointStyle.width, pointStyle.height);
return;
}
}