Skip to content

on_hover: pass MouseEvent to the user #988

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

Closed
CalvinFernandez opened this issue Sep 28, 2016 · 6 comments
Closed

on_hover: pass MouseEvent to the user #988

CalvinFernandez opened this issue Sep 28, 2016 · 6 comments
Labels
feature something new

Comments

@CalvinFernandez
Copy link

Currently, Plotly doesn't pass the raw MouseEvent to the user. I'd like to use clientX and clientY to determine the location of the user's cursor at the time the hover event was fired to render a custom tooltip.

would like to augment the hover event, something like on_hover: (data, event)

@rreusser
Copy link
Contributor

rreusser commented Sep 28, 2016

@etpinard we've been discussing object containers for data so that we can bundle more information along with event callbacks. I don't know precisely what this means for backwards compatibility (i.e. which fraction of events do this already), but perhaps this is a use-case. I think ideally all events would pass an object (or at least a variable-list length of arguments) so that items like this could at least be added without versioning fears.

@etpinard
Copy link
Contributor

Yeah, that would be nice.

I'll referenced #168 and #145 but this request deserves a ticker of its own. Thanks @CalvinFernandez

I would prefer that our plotly_ events pass one lone object as event data, so maybe the signature could be:

gd.on('plotly_hover', (eventData) => {
   eventData.event // => original Mouse Event object
});

Implementing for cartesian plots should be easy. Doing the same for our gl3d plots will be a bit of a headache though.

@etpinard etpinard added the feature something new label Sep 28, 2016
@rreusser
Copy link
Contributor

Does this require a major version bump?

@etpinard
Copy link
Contributor

Does this require a major version bump?

Not if we link the event object to the existing eventData object.

@etpinard
Copy link
Contributor

cc @n-riesco

@etpinard
Copy link
Contributor

Done in #1505

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

No branches or pull requests

3 participants