Skip to content

Commit

Permalink
Draw active points last (#6944)
Browse files Browse the repository at this point in the history
  • Loading branch information
kurkle authored and etimberg committed Jan 10, 2020
1 parent 8d7d557 commit 547aa51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/controllers/controller.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,26 @@ export default DatasetController.extend({
const meta = me._cachedMeta;
const points = meta.data || [];
const area = chart.chartArea;
const ilen = points.length;
let i = 0;
const active = [];
let ilen = points.length;
let i, point;

if (me._showLine) {
meta.dataset.draw(ctx, area);
}


// Draw the points
for (; i < ilen; ++i) {
points[i].draw(ctx, area);
for (i = 0; i < ilen; ++i) {
point = points[i];
if (point.active) {
active.push(point);
} else {
point.draw(ctx, area);
}
}
for (i = 0, ilen = active.length; i < ilen; ++i) {
active[i].draw(ctx, area);
}
},
});
1 change: 1 addition & 0 deletions src/core/core.datasetController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,7 @@ helpers.extend(DatasetController.prototype, {
* @private
*/
_setStyle(element, index, mode, active) {
element.active = active;
this._resolveAnimations(index, mode, active).update(element, {options: this.getStyle(index, active)});
},

Expand Down

0 comments on commit 547aa51

Please sign in to comment.