Track lastTooltipActive for change animations

Since we split up the hover and tooltips modes, both changes need to be
tracked for visual updates between the two.
This commit is contained in:
Tanner Linsley 2015-10-23 12:40:38 -06:00
parent 965d74e34a
commit bc41909e7a

View File

@ -371,6 +371,7 @@
}, },
eventHandler: function eventHandler(e) { eventHandler: function eventHandler(e) {
this.lastActive = this.lastActive || []; this.lastActive = this.lastActive || [];
this.lastTooltipActive = this.lastTooltipActive || [];
// Find Active Elements for hover and tooltips // Find Active Elements for hover and tooltips
if (e.type == 'mouseout') { if (e.type == 'mouseout') {
@ -484,10 +485,19 @@
} }
}, this); }, this);
helpers.each(this.tooltipActive, function(element, index) {
if (element !== this.lastTooltipActive[index]) {
changed = true;
}
}, this);
// If entering, leaving, or changing elements, animate the change via pivot // If entering, leaving, or changing elements, animate the change via pivot
if ((!this.lastActive.length && this.active.length) || if ((!this.lastActive.length && this.active.length) ||
(this.lastActive.length && !this.active.length) || (this.lastActive.length && !this.active.length) ||
(this.lastActive.length && this.active.length && changed)) { (this.lastActive.length && this.active.length && changed) ||
(!this.lastTooltipActive.length && this.tooltipActive.length) ||
(this.lastTooltipActive.length && !this.tooltipActive.length) ||
(this.lastTooltipActive.length && this.tooltipActive.length && changed)) {
this.stop(); this.stop();
@ -497,8 +507,9 @@
} }
} }
// Remember Last Active // Remember Last Actives
this.lastActive = this.active; this.lastActive = this.active;
this.lastTooltipActive = this.tooltipActive;
return this; return this;
}, },
}); });