From: Jukka Kurkela Date: Thu, 2 Sep 2021 00:39:48 +0000 (+0300) Subject: Fix control points on animated line w/o border (#9592) X-Git-Tag: v3.6.0~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d68b119bcb95af182cc69d42acad8490af53d3e;p=thirdparty%2FChart.js.git Fix control points on animated line w/o border (#9592) Co-authored-by: Jukka Kurkela --- diff --git a/src/elements/element.line.js b/src/elements/element.line.js index c09548c41..55752c6c1 100644 --- a/src/elements/element.line.js +++ b/src/elements/element.line.js @@ -395,15 +395,13 @@ export default class LineElement extends Element { const options = me.options || {}; const points = me.points || []; - if (!points.length || !options.borderWidth) { - return; - } + if (points.length && options.borderWidth) { + ctx.save(); - ctx.save(); + draw(ctx, me, start, count); - draw(ctx, me, start, count); - - ctx.restore(); + ctx.restore(); + } if (me.animated) { // When line is animated, the control points and path are not cached. diff --git a/test/fixtures/controller.line/fill/no-border.js b/test/fixtures/controller.line/fill/no-border.js new file mode 100644 index 000000000..5846762e3 --- /dev/null +++ b/test/fixtures/controller.line/fill/no-border.js @@ -0,0 +1,41 @@ +module.exports = { + config: { + type: 'line', + data: { + labels: [0, 1, 2, 3, 4, 5], + datasets: [ + { + data: [12, 19, 3, 5, 2, 3], + backgroundColor: '#ff0000', + borderWidth: 0, + tension: 0.4, + fill: true + }, + ] + }, + options: { + animation: { + duration: 1 + }, + scales: { + x: {display: false}, + y: {display: false} + }, + plugins: { + legend: false, + title: false, + tooltip: false, + filler: true + } + } + }, + options: { + canvas: { + height: 256, + width: 512 + }, + run() { + return new Promise(resolve => setTimeout(resolve, 50)); + } + } +}; diff --git a/test/fixtures/controller.line/fill/no-border.png b/test/fixtures/controller.line/fill/no-border.png new file mode 100644 index 000000000..b140ceafa Binary files /dev/null and b/test/fixtures/controller.line/fill/no-border.png differ