15
15
*/
16
16
( function ( $ , undefined ) {
17
17
18
- function isOverAxis ( x , reference , size ) {
19
- return ( x >= reference ) && ( x < ( reference + size ) ) ;
20
- }
21
-
22
- function isFloating ( item ) {
23
- return ( / l e f t | r i g h t / ) . test ( item . css ( "float" ) ) || ( / i n l i n e | t a b l e - c e l l / ) . test ( item . css ( "display" ) ) ;
24
- }
25
-
26
18
$ . widget ( "ui.sortable" , $ . ui . mouse , {
27
19
version : "@VERSION" ,
28
20
widgetEventPrefix : "sort" ,
@@ -65,6 +57,15 @@ $.widget("ui.sortable", $.ui.mouse, {
65
57
stop : null ,
66
58
update : null
67
59
} ,
60
+
61
+ _isOverAxis : function ( x , reference , size ) {
62
+ return ( x >= reference ) && ( x < ( reference + size ) ) ;
63
+ } ,
64
+
65
+ _isFloating : function ( item ) {
66
+ return ( / l e f t | r i g h t / ) . test ( item . css ( "float" ) ) || ( / i n l i n e | t a b l e - c e l l / ) . test ( item . css ( "display" ) ) ;
67
+ } ,
68
+
68
69
_create : function ( ) {
69
70
70
71
var o = this . options ;
@@ -75,7 +76,7 @@ $.widget("ui.sortable", $.ui.mouse, {
75
76
this . refresh ( ) ;
76
77
77
78
//Let's determine if the items are being displayed horizontally
78
- this . floating = this . items . length ? o . axis === "x" || isFloating ( this . items [ 0 ] . item ) : false ;
79
+ this . floating = this . items . length ? o . axis === "x" || this . _isFloating ( this . items [ 0 ] . item ) : false ;
79
80
80
81
//Let's determine the parent's offset
81
82
this . offset = this . element . offset ( ) ;
@@ -554,8 +555,8 @@ $.widget("ui.sortable", $.ui.mouse, {
554
555
555
556
_intersectsWithPointer : function ( item ) {
556
557
557
- var isOverElementHeight = ( this . options . axis === "x" ) || isOverAxis ( this . positionAbs . top + this . offset . click . top , item . top , item . height ) ,
558
- isOverElementWidth = ( this . options . axis === "y" ) || isOverAxis ( this . positionAbs . left + this . offset . click . left , item . left , item . width ) ,
558
+ var isOverElementHeight = ( this . options . axis === "x" ) || this . _isOverAxis ( this . positionAbs . top + this . offset . click . top , item . top , item . height ) ,
559
+ isOverElementWidth = ( this . options . axis === "y" ) || this . _isOverAxis ( this . positionAbs . left + this . offset . click . left , item . left , item . width ) ,
559
560
isOverElement = isOverElementHeight && isOverElementWidth ,
560
561
verticalDirection = this . _getDragVerticalDirection ( ) ,
561
562
horizontalDirection = this . _getDragHorizontalDirection ( ) ;
@@ -572,8 +573,8 @@ $.widget("ui.sortable", $.ui.mouse, {
572
573
573
574
_intersectsWithSides : function ( item ) {
574
575
575
- var isOverBottomHalf = isOverAxis ( this . positionAbs . top + this . offset . click . top , item . top + ( item . height / 2 ) , item . height ) ,
576
- isOverRightHalf = isOverAxis ( this . positionAbs . left + this . offset . click . left , item . left + ( item . width / 2 ) , item . width ) ,
576
+ var isOverBottomHalf = this . _isOverAxis ( this . positionAbs . top + this . offset . click . top , item . top + ( item . height / 2 ) , item . height ) ,
577
+ isOverRightHalf = this . _isOverAxis ( this . positionAbs . left + this . offset . click . left , item . left + ( item . width / 2 ) , item . width ) ,
577
578
verticalDirection = this . _getDragVerticalDirection ( ) ,
578
579
horizontalDirection = this . _getDragHorizontalDirection ( ) ;
579
580
@@ -846,7 +847,7 @@ $.widget("ui.sortable", $.ui.mouse, {
846
847
//When entering a new container, we will find the item with the least distance and append our item near it
847
848
dist = 10000 ;
848
849
itemWithLeastDistance = null ;
849
- floating = innermostContainer . floating || isFloating ( this . currentItem ) ;
850
+ floating = innermostContainer . floating || this . _isFloating ( this . currentItem ) ;
850
851
posProperty = floating ? "left" : "top" ;
851
852
sizeProperty = floating ? "width" : "height" ;
852
853
base = this . positionAbs [ posProperty ] + this . offset . click [ posProperty ] ;
@@ -857,7 +858,7 @@ $.widget("ui.sortable", $.ui.mouse, {
857
858
if ( this . items [ j ] . item [ 0 ] === this . currentItem [ 0 ] ) {
858
859
continue ;
859
860
}
860
- if ( floating && ! isOverAxis ( this . positionAbs . top + this . offset . click . top , this . items [ j ] . top , this . items [ j ] . height ) ) {
861
+ if ( floating && ! this . _isOverAxis ( this . positionAbs . top + this . offset . click . top , this . items [ j ] . top , this . items [ j ] . height ) ) {
861
862
continue ;
862
863
}
863
864
cur = this . items [ j ] . item . offset ( ) [ posProperty ] ;
0 commit comments