Skip to content

Commit

Permalink
Fix/3061 (#3446)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
etimberg authored Oct 9, 2016
1 parent 65a06e4 commit d21a853
Show file tree
Hide file tree
Showing 2 changed files with 294 additions and 242 deletions.
6 changes: 2 additions & 4 deletions src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ module.exports = function(Chart) {
_data: me.data,
_options: me.options.tooltips
}, me);
me.tooltip.initialize();
},

bindEvents: function() {
Expand Down Expand Up @@ -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) ||
Expand All @@ -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
Expand Down
Loading

0 comments on commit d21a853

Please sign in to comment.