From: Jamie McElwain Date: Sat, 13 May 2017 11:11:52 +0000 (+0100) Subject: Added width + height arguments to ctx.drawImage X-Git-Tag: v2.6.0~2^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0bbc3fa8f3f3031da23923670429aeca0a3e4af1;p=thirdparty%2FChart.js.git 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. --- diff --git a/src/core/core.canvasHelpers.js b/src/core/core.canvasHelpers.js index 7d420524a..610095122 100644 --- a/src/core/core.canvasHelpers.js +++ b/src/core/core.canvasHelpers.js @@ -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; } }