File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ HTMLWidgets.widget({
157
157
graphDiv . on ( "plotly_selected" , function plotly_selecting ( e ) {
158
158
if ( e ) {
159
159
var selectedKeys = pointsToKeys ( e . points ) ;
160
- grp . var ( "selection" ) . set ( selectedKeys ) ;
160
+ grp . var ( "selection" ) . set ( selectedKeys , { sender : el } ) ;
161
161
}
162
162
} ) ;
163
163
// When plotly selection is cleared, update crosstalk
@@ -169,6 +169,17 @@ HTMLWidgets.widget({
169
169
grp . var ( "selection" ) . on ( "change" , function crosstalk_sel_change ( e ) {
170
170
// e.value is either null, or an array of newly selected values
171
171
172
+ if ( e . sender !== el ) {
173
+ // If we're not the originator of this selection, and we have an
174
+ // active selection outline box, we need to remove it. Otherwise
175
+ // it could appear like there are two active brushes in one plot
176
+ // group.
177
+ var outlines = el . querySelectorAll ( ".select-outline" ) ;
178
+ for ( var i = 0 ; i < outlines . length ; i ++ ) {
179
+ outlines [ i ] . remove ( ) ;
180
+ }
181
+ }
182
+
172
183
// Restyle each relevant trace
173
184
var selectedPoints = keysToPoints ( e . value || [ ] ) ;
174
185
You can’t perform that action at this time.
0 commit comments