Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit d00621f

Browse files
committed
clear on deselect events as well
1 parent 1ee676a commit d00621f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

dash_core_components/metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@
925925
"name": "bool"
926926
},
927927
"required": false,
928-
"description": "If True, `clear_on_doubleclick` will clear the `clickData` property\nwhen the user double clicks (when dragmode='zoom').",
928+
"description": "If True, `clear_on_doubleclick` will clear the `clickData` property\nwhen the user double clicks.",
929929
"defaultValue": {
930930
"value": "false",
931931
"computed": false

src/components/Graph.react.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ export default class PlotlyGraph extends Component {
130130
gd.on('plotly_deselect', () => {
131131
if (setProps) setProps({selectedData: null});
132132
if (fireEvent) fireEvent({event: 'selected'});
133+
if (clear_on_doubleclick) {
134+
if (setProps) setProps({clickData: null});
135+
if (fireEvent) fireEvent({event: 'unclick'});
136+
}
133137
});
134138
gd.on('plotly_relayout', (eventData) => {
135139
const relayoutData = filterEventData(gd, eventData, 'relayout');
@@ -147,7 +151,7 @@ export default class PlotlyGraph extends Component {
147151
gd.on('plotly_doubleclick', () => {
148152
if (clear_on_doubleclick) {
149153
if (setProps) setProps({clickData: null});
150-
if (fireEvent) fireEvent({event: 'doubleclick'});
154+
if (fireEvent) fireEvent({event: 'unclick'});
151155
}
152156
})
153157

@@ -221,7 +225,7 @@ PlotlyGraph.propTypes = {
221225

222226
/**
223227
* If True, `clear_on_doubleclick` will clear the `clickData` property
224-
* when the user double clicks (when dragmode='zoom').
228+
* when the user double clicks.
225229
*/
226230
clear_on_doubleclick: PropTypes.bool,
227231

0 commit comments

Comments
 (0)