@@ -178,11 +178,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
178
178
prepSelect ( e , startX , startY , dragOptions , dragModeNow ) ;
179
179
} else {
180
180
dragOptions . clickFn = clickFn ;
181
- // clear selection polygon cache (if any)
182
- plotinfo . selection = false ;
183
181
184
182
if ( allFixedRanges ) {
185
- clearSelect ( zoomlayer ) ;
183
+ clearAndResetSelect ( ) ;
186
184
} else if ( dragModeNow === 'zoom' ) {
187
185
dragOptions . moveFn = zoomMove ;
188
186
dragOptions . doneFn = zoomDone ;
@@ -196,11 +194,18 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
196
194
} else if ( dragModeNow === 'pan' ) {
197
195
dragOptions . moveFn = plotDrag ;
198
196
dragOptions . doneFn = dragTail ;
199
- clearSelect ( zoomlayer ) ;
197
+ clearAndResetSelect ( ) ;
200
198
}
201
199
}
202
200
} ;
203
201
202
+ function clearAndResetSelect ( ) {
203
+ // clear selection polygon cache (if any)
204
+ dragOptions . plotinfo . selection = false ;
205
+ // clear selection outlines
206
+ clearSelect ( zoomlayer ) ;
207
+ }
208
+
204
209
function clickFn ( numClicks , evt ) {
205
210
removeZoombox ( gd ) ;
206
211
@@ -281,7 +286,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
281
286
282
287
corners = makeCorners ( zoomlayer , xs , ys ) ;
283
288
284
- clearSelect ( zoomlayer ) ;
289
+ clearAndResetSelect ( ) ;
285
290
}
286
291
287
292
function zoomMove ( dx0 , dy0 ) {
@@ -393,7 +398,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
393
398
return ;
394
399
}
395
400
396
- clearSelect ( zoomlayer ) ;
401
+ clearAndResetSelect ( ) ;
397
402
398
403
// If a transition is in progress, then disable any behavior:
399
404
if ( gd . _transitioningWithDuration ) {
0 commit comments