@@ -59,7 +59,7 @@ $.widget("ui.sortable", $.ui.mouse, {
59
59
60
60
//Initialize mouse events for interaction
61
61
this . _mouseInit ( ) ;
62
-
62
+
63
63
//We're ready to go
64
64
this . ready = true
65
65
@@ -79,7 +79,7 @@ $.widget("ui.sortable", $.ui.mouse, {
79
79
_setOption : function ( key , value ) {
80
80
if ( key === "disabled" ) {
81
81
this . options [ key ] = value ;
82
-
82
+
83
83
this . widget ( ) . toggleClass ( "ui-sortable-disabled" , ! ! value ) ;
84
84
} else {
85
85
// Don't call widget base _setOption for disable as it adds ui-state-disabled class
@@ -519,7 +519,7 @@ $.widget("ui.sortable", $.ui.mouse, {
519
519
? [ options . connectWith ]
520
520
: options . connectWith ;
521
521
} ,
522
-
522
+
523
523
_getItemsAsjQuery : function ( connected ) {
524
524
525
525
var self = this ;
@@ -692,71 +692,71 @@ $.widget("ui.sortable", $.ui.mouse, {
692
692
} ,
693
693
694
694
_contactContainers : function ( event ) {
695
-
696
- // get innermost container that intersects with item
697
- var innermostContainer = null , innermostIndex = null ;
698
-
699
-
695
+
696
+ // get innermost container that intersects with item
697
+ var innermostContainer = null , innermostIndex = null ;
698
+
699
+
700
700
for ( var i = this . containers . length - 1 ; i >= 0 ; i -- ) {
701
701
702
- // never consider a container that's located within the item itself
702
+ // never consider a container that's located within the item itself
703
703
if ( $ . contains ( this . currentItem [ 0 ] , this . containers [ i ] . element [ 0 ] ) )
704
704
continue ;
705
705
706
706
if ( this . _intersectsWith ( this . containers [ i ] . containerCache ) ) {
707
707
708
- // if we've already found a container and it's more "inner" than this, then continue
708
+ // if we've already found a container and it's more "inner" than this, then continue
709
709
if ( innermostContainer && $ . contains ( this . containers [ i ] . element [ 0 ] , innermostContainer . element [ 0 ] ) )
710
710
continue ;
711
711
712
- innermostContainer = this . containers [ i ] ;
712
+ innermostContainer = this . containers [ i ] ;
713
713
innermostIndex = i ;
714
-
714
+
715
715
} else {
716
- // container doesn't intersect. trigger "out" event if necessary
716
+ // container doesn't intersect. trigger "out" event if necessary
717
717
if ( this . containers [ i ] . containerCache . over ) {
718
718
this . containers [ i ] . _trigger ( "out" , event , this . _uiHash ( this ) ) ;
719
719
this . containers [ i ] . containerCache . over = 0 ;
720
720
}
721
721
}
722
722
723
723
}
724
-
725
- // if no intersecting containers found, return
726
- if ( ! innermostContainer ) return ;
724
+
725
+ // if no intersecting containers found, return
726
+ if ( ! innermostContainer ) return ;
727
727
728
728
// move the item into the container if it's not there already
729
729
if ( this . containers . length === 1 ) {
730
730
this . containers [ innermostIndex ] . _trigger ( "over" , event , this . _uiHash ( this ) ) ;
731
731
this . containers [ innermostIndex ] . containerCache . over = 1 ;
732
- } else if ( this . currentContainer != this . containers [ innermostIndex ] ) {
733
-
734
- //When entering a new container, we will find the item with the least distance and append our item near it
735
- var dist = 10000 ; var itemWithLeastDistance = null ; var base = this . positionAbs [ this . containers [ innermostIndex ] . floating ? 'left' : 'top' ] ;
736
- for ( var j = this . items . length - 1 ; j >= 0 ; j -- ) {
737
- if ( ! $ . contains ( this . containers [ innermostIndex ] . element [ 0 ] , this . items [ j ] . item [ 0 ] ) ) continue ;
738
- var cur = this . items [ j ] [ this . containers [ innermostIndex ] . floating ? 'left' : 'top' ] ;
739
- if ( Math . abs ( cur - base ) < dist ) {
740
- dist = Math . abs ( cur - base ) ; itemWithLeastDistance = this . items [ j ] ;
741
- }
742
- }
743
-
744
- if ( ! itemWithLeastDistance && ! this . options . dropOnEmpty ) //Check if dropOnEmpty is enabled
745
- return ;
746
-
747
- this . currentContainer = this . containers [ innermostIndex ] ;
748
- itemWithLeastDistance ? this . _rearrange ( event , itemWithLeastDistance , null , true ) : this . _rearrange ( event , null , this . containers [ innermostIndex ] . element , true ) ;
749
- this . _trigger ( "change" , event , this . _uiHash ( ) ) ;
750
- this . containers [ innermostIndex ] . _trigger ( "change" , event , this . _uiHash ( this ) ) ;
751
-
752
- //Update the placeholder
753
- this . options . placeholder . update ( this . currentContainer , this . placeholder ) ;
754
-
755
- this . containers [ innermostIndex ] . _trigger ( "over" , event , this . _uiHash ( this ) ) ;
732
+ } else if ( this . currentContainer != this . containers [ innermostIndex ] ) {
733
+
734
+ //When entering a new container, we will find the item with the least distance and append our item near it
735
+ var dist = 10000 ; var itemWithLeastDistance = null ; var base = this . positionAbs [ this . containers [ innermostIndex ] . floating ? 'left' : 'top' ] ;
736
+ for ( var j = this . items . length - 1 ; j >= 0 ; j -- ) {
737
+ if ( ! $ . contains ( this . containers [ innermostIndex ] . element [ 0 ] , this . items [ j ] . item [ 0 ] ) ) continue ;
738
+ var cur = this . items [ j ] [ this . containers [ innermostIndex ] . floating ? 'left' : 'top' ] ;
739
+ if ( Math . abs ( cur - base ) < dist ) {
740
+ dist = Math . abs ( cur - base ) ; itemWithLeastDistance = this . items [ j ] ;
741
+ }
742
+ }
743
+
744
+ if ( ! itemWithLeastDistance && ! this . options . dropOnEmpty ) //Check if dropOnEmpty is enabled
745
+ return ;
746
+
747
+ this . currentContainer = this . containers [ innermostIndex ] ;
748
+ itemWithLeastDistance ? this . _rearrange ( event , itemWithLeastDistance , null , true ) : this . _rearrange ( event , null , this . containers [ innermostIndex ] . element , true ) ;
749
+ this . _trigger ( "change" , event , this . _uiHash ( ) ) ;
750
+ this . containers [ innermostIndex ] . _trigger ( "change" , event , this . _uiHash ( this ) ) ;
751
+
752
+ //Update the placeholder
753
+ this . options . placeholder . update ( this . currentContainer , this . placeholder ) ;
754
+
755
+ this . containers [ innermostIndex ] . _trigger ( "over" , event , this . _uiHash ( this ) ) ;
756
756
this . containers [ innermostIndex ] . containerCache . over = 1 ;
757
- }
758
-
759
-
757
+ }
758
+
759
+
760
760
} ,
761
761
762
762
_createHelper : function ( event ) {
0 commit comments