react-plotly.js icon indicating copy to clipboard operation
react-plotly.js copied to clipboard

`onSelected`: Keep default behavior of events

Open farzadab opened this issue 5 years ago • 5 comments
trafficstars

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: image 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 avatar Apr 29 '20 18:04 farzadab

@farzadab Have you resolved? I am faced with the same problem. :(

2coo avatar Jun 03 '20 09:06 2coo

No, I didn't have many clues to go on really.

farzadab avatar Jun 03 '20 15:06 farzadab

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)

Screen Shot 2022-02-28 at 2 44 54 pm

but instead after a lasso/box select/highlight, all I get is the following:

Screen Shot 2022-02-28 at 2 44 23 pm

It's like setting onSelected and onClicked just overwrites whatever default behaviour existed?

Did you have any ideas @farzadab?

bgriffen avatar Mar 01 '22 14:03 bgriffen

Have you resolved this issue? @farzadab @bgriffen

rajneeshXpandey avatar Jul 14 '22 19:07 rajneeshXpandey