Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix onHover event not being triggered #4297

Merged
merged 2 commits into from May 28, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/core.controller.js
Expand Up @@ -797,6 +797,7 @@ module.exports = function(Chart) {
var me = this;
var options = me.options || {};
var hoverOptions = options.hover;
var hoverCallback = options.onHover || options.hover.onHover;
var changed = false;

me.lastActive = me.lastActive || [];
Expand All @@ -809,9 +810,9 @@ module.exports = function(Chart) {
}

// On Hover hook
if (hoverOptions.onHover) {
if (hoverCallback) {
// Need to call with native event here to not break backwards compatibility
hoverOptions.onHover.call(me, e.native, me.active);
hoverCallback.call(me, e.native, me.active);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be more concise using helpers.callback(options.onHover || options.hover.onHover, [e.native, me.active], me), then no need to test if hoverCallback is defined/null.

}

if (e.type === 'mouseup' || e.type === 'click') {
Expand Down