@@ -36,6 +36,7 @@ mousedownPos (object with x/y during draggingReady, shows where the selection st
36
36
selectedPos (object with x/y/h/w during selected or dragging, gives the entire selection)
37
37
resizeDirection (string: top, topLeft, etc, during resizing)
38
38
resizeStartPos (x/y position where resizing started)
39
+ mouseupNoAutoselect (true if a mouseup in draggingReady should not trigger autoselect)
39
40
40
41
*/
41
42
@@ -147,6 +148,7 @@ let resizeDirection;
147
148
let resizeStartPos ;
148
149
let resizeStartSelected ;
149
150
let resizeHasMoved ;
151
+ let mouseupNoAutoselect = false ;
150
152
151
153
/** Represents a selection box: */
152
154
class Selection {
@@ -384,6 +386,7 @@ stateHandlers.draggingReady = {
384
386
385
387
start : function ( ) {
386
388
ui . Box . remove ( ) ;
389
+ ui . WholePageOverlay . display ( standardOverlayCallbacks ) ;
387
390
} ,
388
391
389
392
mousemove : function ( event ) {
@@ -400,6 +403,11 @@ stateHandlers.draggingReady = {
400
403
401
404
mouseup : function ( event ) {
402
405
// If we don't get into "dragging" then we attempt an autoselect
406
+ if ( mouseupNoAutoselect ) {
407
+ sendEvent ( "cancel-selection" , "selection-background-mousedown" ) ;
408
+ setState ( "crosshairs" ) ;
409
+ return false ;
410
+ }
403
411
let el = this . findGoodEl ( ) ;
404
412
if ( el ) {
405
413
let rect = el . getBoundingClientRect ( ) ;
@@ -515,6 +523,10 @@ stateHandlers.draggingReady = {
515
523
el = el . parentNode ;
516
524
}
517
525
return null ;
526
+ } ,
527
+
528
+ end : function ( ) {
529
+ mouseupNoAutoselect = false ;
518
530
}
519
531
520
532
} ;
@@ -566,18 +578,16 @@ stateHandlers.selected = {
566
578
if ( direction ) {
567
579
sendEvent ( "start-resize-selection" , "handle" ) ;
568
580
stateHandlers . resizing . startResize ( event , direction ) ;
569
- event . preventDefault ( ) ;
570
- return false ;
571
- }
572
- if ( ! ui . Box . isSelection ( target ) ) {
573
- sendEvent ( "cancel-selection" , "selection-background-mousedown" ) ;
574
- setState ( "crosshairs" ) ;
575
- } else {
581
+ } else if ( ui . Box . isSelection ( target ) ) {
576
582
sendEvent ( "start-move-selection" , "selection" ) ;
577
583
stateHandlers . resizing . startResize ( event , "move" ) ;
578
- event . preventDefault ( ) ;
579
- return false ;
584
+ } else {
585
+ mousedownPos = new Pos ( event . pageX , event . pageY ) ;
586
+ mouseupNoAutoselect = true ;
587
+ setState ( "draggingReady" ) ;
580
588
}
589
+ event . preventDefault ( ) ;
590
+ return false ;
581
591
}
582
592
} ;
583
593
0 commit comments