@@ -174,30 +174,32 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
174
174
if ( isSelectOrLasso ( dragModeNow ) ) {
175
175
dragOptions . xaxes = xaxes ;
176
176
dragOptions . yaxes = yaxes ;
177
+ // this attaches moveFn, clickFn, doneFn on dragOptions
177
178
prepSelect ( e , startX , startY , dragOptions , dragModeNow ) ;
178
- }
179
- else if ( allFixedRanges ) {
180
- clearSelect ( zoomlayer ) ;
181
- }
182
- else if ( dragModeNow === 'zoom' ) {
183
- dragOptions . moveFn = zoomMove ;
184
- dragOptions . doneFn = zoomDone ;
185
-
186
- // zoomMove takes care of the threshold, but we need to
187
- // minimize this so that constrained zoom boxes will flip
188
- // orientation at the right place
189
- dragOptions . minDrag = 1 ;
190
-
191
- zoomPrep ( e , startX , startY ) ;
192
- }
193
- else if ( dragModeNow === 'pan' ) {
194
- dragOptions . moveFn = plotDrag ;
195
- dragOptions . doneFn = dragTail ;
196
- clearSelect ( zoomlayer ) ;
179
+ } else {
180
+ dragOptions . clickFn = clickFn ;
181
+
182
+ if ( allFixedRanges ) {
183
+ clearSelect ( zoomlayer ) ;
184
+ } else if ( dragModeNow === 'zoom' ) {
185
+ dragOptions . moveFn = zoomMove ;
186
+ dragOptions . doneFn = zoomDone ;
187
+
188
+ // zoomMove takes care of the threshold, but we need to
189
+ // minimize this so that constrained zoom boxes will flip
190
+ // orientation at the right place
191
+ dragOptions . minDrag = 1 ;
192
+
193
+ zoomPrep ( e , startX , startY ) ;
194
+ } else if ( dragModeNow === 'pan' ) {
195
+ dragOptions . moveFn = plotDrag ;
196
+ dragOptions . doneFn = dragTail ;
197
+ clearSelect ( zoomlayer ) ;
198
+ }
197
199
}
198
200
} ;
199
201
200
- dragOptions . clickFn = function ( numClicks , evt ) {
202
+ function clickFn ( numClicks , evt ) {
201
203
removeZoombox ( gd ) ;
202
204
203
205
if ( numClicks === 2 && ! singleEnd ) doubleClick ( ) ;
@@ -240,7 +242,7 @@ function makeDragBox(gd, plotinfo, x, y, w, h, ns, ew) {
240
242
} ) ;
241
243
}
242
244
}
243
- } ;
245
+ }
244
246
245
247
dragElement . init ( dragOptions ) ;
246
248
0 commit comments