-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Feature Request: Make plotly_click events in 3d plots consistent with 2d #6185
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
Comments
I did a little more digging and it seems like it won't be easy to add the DOM I think the relevant section is here: plotly.js/src/plots/gl3d/scene.js Lines 403 to 420 in 12a49c0
What about adding something like the following? Any other useful tidbits we could include here? var eventData = {
points: [pointData],
buttons: selection.buttons,
distance: selection.distance,
}; Then it seems like the plotly.js/src/plots/gl3d/scene.js Lines 450 to 465 in 12a49c0
While i was looking at this, i also noticed that the Something like the following? This is completely untested... if (!selection.buttons && !selection.distance < 5) {
gd.emit('plotly_hover', eventData);
this.oldHoverState = true;
}
this.oldEventData = eventData;
} else {
Fx.loneUnhover(svgContainer);
if (this.oldHoverState) {
gd.emit('plotly_unhover', this.oldEventData);
}
this.oldHover = undefined;
if (this.oldEventData && this.oldEventData.buttons && this.oldEventData.distance < 5) {
gd.emit('plotly_click', this.oldEventData);
}
this.oldEventData = undefined;
}
scene.drawAnnotations(scene);
}; I hesitate to try to make a pr for this since i have almost no experience with js and dont feel like i understand it well enough to make a reliable change. Can i just add |
Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson |
There are some issues/limitations with the 3d plot events, particularly the click event, that aren't present in the equivalent 2d plots. It would really help their functionality to be consistent with the 2d events.
I've been working specifically with
scatter3d
(orsurface
) plots and theplotly_click
event.My biggest issue is that the
plotly_click
event is fired onmousedown
(in a 2dscatter
it is fired onmouseup
). That makes it impossible to tell if the user is intending to select a point, or to click and drag to rotate/pan/zoom, etc. That is an issue since typically a callback related to selecting a point conflicts with a drag to rotate operation. Again, the 2d scatter behaves as intended.Here is a simple demo, the click events are logged to the console, you'll note that in the 2d
scatter
, click and drag (to zoom) does not fire aplotly_click
event, but doing the same thing in the 3d surface plot does fire theploty_click
before the drag functionality.https://codepen.io/cmpctrl/pen/rNJLNLd
One thing i hoped to use to workaround this issue was to detect if the user right clicked on the plot. Unfotunately, the DOM
MouseEvent
data that is, very usefully, included in the 2dclick_data
is missing in the 3d plots.Similarly, there is no
plotly_doubleclick
event for 3d.Some related issues, there may be more.
#2565
#3266
#5590
The text was updated successfully, but these errors were encountered: