react-plotly.js
react-plotly.js copied to clipboard
`onSelected`: Keep default behavior of events
Is there any way to keep the default behavior of events while providing a handler?
From what I understand from this post, unless the overridden function returns false the default behavior should be kept. However, when I provide an onSelected method the default behavior doesn't happen, no matter what the returned value is.
TBH, I'm not sure whether what I'm asking for is the expected behavior, but depending on the answer you can interpret this question as a feature request or a request for document clarification.
To make this more clear, what I see when onSelected is not provided is that the selected area stays active even after mouse is released and you can even select multiple regions like so:
However, when onSelected is provided, the selected region disappears after the mouse is released and I cannot reproduce the same behavior (at least not so easily).
To give you more context, my specific use-case here is to be able to download the information of the selected points using a separate button that I have created, so the default visual response works well for me.
@farzadab Have you resolved? I am faced with the same problem. :(
No, I didn't have many clues to go on really.
I also have the same issue, I have a custom component in Retool ...
onSelected={(v) => {
modelUpdate({ selectedPoints: v.points.map(p => p.text) })
}}
onSelected={(v) => {
modelUpdate({ selectedPoints: v.points.map(p => ({ x: p.x, y: p.y, well: p.text }) })
}}
I want to simply be able to access the points highlighted in my model, which works(!) but the points not highlighted are no longer dimmed out so the user can't tell which wells are highlighted.
E.g. below is what I want to achieve (with the above retention of what has been highlighted)
but instead after a lasso/box select/highlight, all I get is the following:
It's like setting onSelected and onClicked just overwrites whatever default behaviour existed?
Did you have any ideas @farzadab?
Have you resolved this issue? @farzadab @bgriffen