My app applies some logic when a user selects a point on a scatterplot, but double clicking (to zoom out) is triggering that logic. So my question is, how can I differentiate between single and double clicks? ChatGPT is suggesting I use relayoutData as an Input, but I’m having some difficulties with that affecting other behavior so I’d prefer another route if possible. Without relayoutData, is there another way to separate single and double clicks? Thanks!
Welcome @dafrdman!
Not sure if I understand this. You are saying that a double click activates a callback which is supposed to be triggered by the selection of a point?
In general: You could add event listeners, either in JS directly or using dash-extensions
I have a callback that is activated by several things, including both a single click on a point and a double click to zoom out. I wanted the logic within the callback to depend on whether the click was a single selection or a double click.
I think I figured it out though! I can use the following to see what kind of click occurred
ctx = dash.callback_context
trigger_prop = ctx.triggered[0]["prop_id"].split(".")[1] if ctx.triggered else None
Glad you found a solution!
The ctx class has some nice attributes, sometimes its not needed to parse it as you do.