@@ -421,79 +421,76 @@ return $.widget( "ui.sortable", $.ui.mouse, {
421
421
this . helper [ 0 ] . style . top = this . position . top + "px" ;
422
422
}
423
423
424
- //Post events to containers
425
- this . _contactContainers ( event ) ;
426
-
427
- if ( this . innermostContainer !== null ) {
428
-
429
- //Do scrolling
430
- if ( o . scroll ) {
431
- if ( this . _scroll ( event ) !== false ) {
424
+ //Do scrolling
425
+ if ( o . scroll ) {
426
+ if ( this . _scroll ( event ) !== false ) {
432
427
433
- //Update item positions used in position checks
434
- this . _refreshItemPositions ( true ) ;
428
+ //Update item positions used in position checks
429
+ this . _refreshItemPositions ( true ) ;
435
430
436
- if ( $ . ui . ddmanager && ! o . dropBehaviour ) {
437
- $ . ui . ddmanager . prepareOffsets ( this , event ) ;
438
- }
431
+ if ( $ . ui . ddmanager && ! o . dropBehaviour ) {
432
+ $ . ui . ddmanager . prepareOffsets ( this , event ) ;
439
433
}
440
434
}
435
+ }
441
436
442
- this . dragDirection = {
443
- vertical : this . _getDragVerticalDirection ( ) ,
444
- horizontal : this . _getDragHorizontalDirection ( )
445
- } ;
446
-
447
- //Rearrange
448
- for ( i = this . items . length - 1 ; i >= 0 ; i -- ) {
449
-
450
- //Cache variables and intersection, continue if no intersection
451
- item = this . items [ i ] ;
452
- itemElement = item . item [ 0 ] ;
453
- intersection = this . _intersectsWithPointer ( item ) ;
454
- if ( ! intersection ) {
455
- continue ;
456
- }
457
-
458
- // Only put the placeholder inside the current Container, skip all
459
- // items from other containers. This works because when moving
460
- // an item from one container to another the
461
- // currentContainer is switched before the placeholder is moved.
462
- //
463
- // Without this, moving items in "sub-sortables" can cause
464
- // the placeholder to jitter between the outer and inner container.
465
- if ( item . instance !== this . currentContainer ) {
466
- continue ;
467
- }
437
+ this . dragDirection = {
438
+ vertical : this . _getDragVerticalDirection ( ) ,
439
+ horizontal : this . _getDragHorizontalDirection ( )
440
+ } ;
468
441
469
- // Cannot intersect with itself
470
- // no useless actions that have been done before
471
- // no action if the item moved is the parent of the item checked
472
- if ( itemElement !== this . currentItem [ 0 ] &&
473
- this . placeholder [ intersection === 1 ?
474
- "next" : "prev" ] ( ) [ 0 ] !== itemElement &&
475
- ! $ . contains ( this . placeholder [ 0 ] , itemElement ) &&
476
- ( this . options . type === "semi-dynamic" ?
477
- ! $ . contains ( this . element [ 0 ] , itemElement ) :
478
- true
479
- )
480
- ) {
442
+ //Rearrange
443
+ for ( i = this . items . length - 1 ; i >= 0 ; i -- ) {
481
444
482
- this . direction = intersection === 1 ? "down" : "up" ;
445
+ //Cache variables and intersection, continue if no intersection
446
+ item = this . items [ i ] ;
447
+ itemElement = item . item [ 0 ] ;
448
+ intersection = this . _intersectsWithPointer ( item ) ;
449
+ if ( ! intersection ) {
450
+ continue ;
451
+ }
483
452
484
- if ( this . options . tolerance === "pointer" ||
485
- this . _intersectsWithSides ( item ) ) {
486
- this . _rearrange ( event , item ) ;
487
- } else {
488
- break ;
489
- }
453
+ // Only put the placeholder inside the current Container, skip all
454
+ // items from other containers. This works because when moving
455
+ // an item from one container to another the
456
+ // currentContainer is switched before the placeholder is moved.
457
+ //
458
+ // Without this, moving items in "sub-sortables" can cause
459
+ // the placeholder to jitter between the outer and inner container.
460
+ if ( item . instance !== this . currentContainer ) {
461
+ continue ;
462
+ }
490
463
491
- this . _trigger ( "change" , event , this . _uiHash ( ) ) ;
464
+ // Cannot intersect with itself
465
+ // no useless actions that have been done before
466
+ // no action if the item moved is the parent of the item checked
467
+ if ( itemElement !== this . currentItem [ 0 ] &&
468
+ this . placeholder [ intersection === 1 ?
469
+ "next" : "prev" ] ( ) [ 0 ] !== itemElement &&
470
+ ! $ . contains ( this . placeholder [ 0 ] , itemElement ) &&
471
+ ( this . options . type === "semi-dynamic" ?
472
+ ! $ . contains ( this . element [ 0 ] , itemElement ) :
473
+ true
474
+ )
475
+ ) {
476
+
477
+ this . direction = intersection === 1 ? "down" : "up" ;
478
+
479
+ if ( this . options . tolerance === "pointer" ||
480
+ this . _intersectsWithSides ( item ) ) {
481
+ this . _rearrange ( event , item ) ;
482
+ } else {
492
483
break ;
493
484
}
485
+
486
+ this . _trigger ( "change" , event , this . _uiHash ( ) ) ;
487
+ break ;
494
488
}
495
489
}
496
490
491
+ //Post events to containers
492
+ this . _contactContainers ( event ) ;
493
+
497
494
//Interconnect with droppables
498
495
if ( $ . ui . ddmanager ) {
499
496
$ . ui . ddmanager . drag ( this , event ) ;
@@ -888,9 +885,7 @@ return $.widget( "ui.sortable", $.ui.mouse, {
888
885
this . options . axis === "x" || this . _isFloating ( this . items [ 0 ] . item ) :
889
886
false ;
890
887
891
- if ( this . innermostContainer !== null ) {
892
- this . _refreshItemPositions ( fast ) ;
893
- }
888
+ this . _refreshItemPositions ( fast ) ;
894
889
895
890
var i , p ;
896
891
@@ -1038,8 +1033,6 @@ return $.widget( "ui.sortable", $.ui.mouse, {
1038
1033
1039
1034
}
1040
1035
1041
- this . innermostContainer = innermostContainer ;
1042
-
1043
1036
// If no intersecting containers found, return
1044
1037
if ( ! innermostContainer ) {
1045
1038
return ;
0 commit comments