]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Added width + height arguments to ctx.drawImage
authorJamie McElwain <jgmcelwain@icloud.com>
Sat, 13 May 2017 11:11:52 +0000 (12:11 +0100)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 13 May 2017 13:26:20 +0000 (09:26 -0400)
Previous functionality meant that images would be drawn at their source file size regardless of whether custom width or height properties were set.

src/core/core.canvasHelpers.js

index 7d420524a8d8fc87b7c356ce221ca93b7821522b..610095122b8c618ebfed83d953f091c2cf6a26ed 100644 (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;
                        }
                }