mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-25 01:26:53 +01:00
Fix/3061 (#3446)
Solve weird animation issues with the tooltip. The optimization in Chart.Element.transition when the animation finishes to set `_view = _model` caused problems during update because we were using `helpers.extend` all over the place. I changed to code so that we regenerate the model variable rather than continuously extending the old version. I also removed unnecessary tooltip reinitializations from the controller which should improve overall performance during interaction.
This commit is contained in:
@@ -630,6 +630,7 @@ module.exports = function(Chart) {
|
||||
_data: me.data,
|
||||
_options: me.options.tooltips
|
||||
}, me);
|
||||
me.tooltip.initialize();
|
||||
},
|
||||
|
||||
bindEvents: function() {
|
||||
@@ -711,14 +712,10 @@ module.exports = function(Chart) {
|
||||
|
||||
// Built in Tooltips
|
||||
if (tooltipsOptions.enabled || tooltipsOptions.custom) {
|
||||
tooltip.initialize();
|
||||
tooltip._active = me.tooltipActive;
|
||||
tooltip.update(true);
|
||||
}
|
||||
|
||||
// Hover animations
|
||||
tooltip.pivot();
|
||||
|
||||
if (!me.animating) {
|
||||
// If entering, leaving, or changing elements, animate the change via pivot
|
||||
if (!helpers.arrayEquals(me.active, me.lastActive) ||
|
||||
@@ -728,6 +725,7 @@ module.exports = function(Chart) {
|
||||
|
||||
if (tooltipsOptions.enabled || tooltipsOptions.custom) {
|
||||
tooltip.update(true);
|
||||
tooltip.pivot();
|
||||
}
|
||||
|
||||
// We only need to render at this point. Updating will cause scales to be
|
||||
|
||||
Reference in New Issue
Block a user