]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Track lastTooltipActive for change animations
authorTanner Linsley <tannerlinsley@gmail.com>
Fri, 23 Oct 2015 18:40:38 +0000 (12:40 -0600)
committerTanner Linsley <tannerlinsley@gmail.com>
Fri, 23 Oct 2015 18:41:21 +0000 (12:41 -0600)
Since we split up the hover and tooltips modes, both changes need to be
tracked for visual updates between the two.

src/core/core.controller.js

index 45e8869e5d1df4219a83e66566ff29145e353336..13695081a09da3d0bb98339ea4f9602877ee6b35 100644 (file)
                },
                eventHandler: function eventHandler(e) {
                        this.lastActive = this.lastActive || [];
+                       this.lastTooltipActive = this.lastTooltipActive || [];
 
                        // Find Active Elements for hover and tooltips
                        if (e.type == 'mouseout') {
                                        }
                                }, 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 ((!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();
 
                                }
                        }
 
-                       // Remember Last Active
+                       // Remember Last Actives
                        this.lastActive = this.active;
+                       this.lastTooltipActive = this.tooltipActive;
                        return this;
                },
        });