@@ -178,11 +178,9 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
178178 prepSelect ( e , startX , startY , dragOptions , dragModeNow ) ;
179179 } else {
180180 dragOptions . clickFn = clickFn ;
181- // clear selection polygon cache (if any)
182- plotinfo . selection = false ;
183181
184182 if ( allFixedRanges ) {
185- clearSelect ( zoomlayer ) ;
183+ clearAndResetSelect ( ) ;
186184 } else if ( dragModeNow === 'zoom' ) {
187185 dragOptions . moveFn = zoomMove ;
188186 dragOptions . doneFn = zoomDone ;
@@ -196,11 +194,18 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
196194 } else if ( dragModeNow === 'pan' ) {
197195 dragOptions . moveFn = plotDrag ;
198196 dragOptions . doneFn = dragTail ;
199- clearSelect ( zoomlayer ) ;
197+ clearAndResetSelect ( ) ;
200198 }
201199 }
202200 } ;
203201
202+ function clearAndResetSelect ( ) {
203+ // clear selection polygon cache (if any)
204+ dragOptions . plotinfo . selection = false ;
205+ // clear selection outlines
206+ clearSelect ( zoomlayer ) ;
207+ }
208+
204209 function clickFn ( numClicks , evt ) {
205210 removeZoombox ( gd ) ;
206211
@@ -281,7 +286,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
281286
282287 corners = makeCorners ( zoomlayer , xs , ys ) ;
283288
284- clearSelect ( zoomlayer ) ;
289+ clearAndResetSelect ( ) ;
285290 }
286291
287292 function zoomMove ( dx0 , dy0 ) {
@@ -393,7 +398,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
393398 return ;
394399 }
395400
396- clearSelect ( zoomlayer ) ;
401+ clearAndResetSelect ( ) ;
397402
398403 // If a transition is in progress, then disable any behavior:
399404 if ( gd . _transitioningWithDuration ) {
0 commit comments