@@ -34,7 +34,8 @@ import {
34
34
throttle ,
35
35
scrollBy ,
36
36
clone ,
37
- expando
37
+ expando ,
38
+ getContentRect
38
39
} from './utils.js' ;
39
40
40
41
@@ -1788,21 +1789,23 @@ function _unsilent() {
1788
1789
}
1789
1790
1790
1791
function _ghostIsFirst ( evt , vertical , sortable ) {
1791
- let rect = getRect ( getChild ( sortable . el , 0 , sortable . options , true ) ) ;
1792
+ let firstElRect = getRect ( getChild ( sortable . el , 0 , sortable . options , true ) ) ;
1793
+ const sortableContentRect = getContentRect ( sortable . el ) ;
1792
1794
const spacer = 10 ;
1793
1795
1794
1796
return vertical ?
1795
- ( ( evt . clientX < rect . left - spacer ) || ( evt . clientY < rect . top && evt . clientX < rect . right ) ) :
1796
- ( ( evt . clientY < rect . top - spacer ) || ( evt . clientY < rect . bottom && evt . clientX < rect . left ) )
1797
+ ( evt . clientX < sortableContentRect . left - spacer || evt . clientY < firstElRect . top && evt . clientX < firstElRect . right ) :
1798
+ ( evt . clientY < sortableContentRect . top - spacer || evt . clientY < firstElRect . bottom && evt . clientX < firstElRect . left )
1797
1799
}
1798
1800
1799
1801
function _ghostIsLast ( evt , vertical , sortable ) {
1800
- let rect = getRect ( lastChild ( sortable . el , sortable . options . draggable ) ) ;
1802
+ const lastElRect = getRect ( lastChild ( sortable . el , sortable . options . draggable ) ) ;
1803
+ const sortableContentRect = getContentRect ( sortable . el ) ;
1801
1804
const spacer = 10 ;
1802
1805
1803
1806
return vertical ?
1804
- ( evt . clientX > rect . right + spacer || evt . clientX <= rect . right && evt . clientY > rect . bottom && evt . clientX >= rect . left ) :
1805
- ( evt . clientX > rect . right && evt . clientY > rect . top || evt . clientX <= rect . right && evt . clientY > rect . bottom + spacer ) ;
1807
+ ( evt . clientX > sortableContentRect . right + spacer || evt . clientY > lastElRect . bottom && evt . clientX > lastElRect . left ) :
1808
+ ( evt . clientY > sortableContentRect . bottom + spacer || evt . clientX > lastElRect . right && evt . clientY > lastElRect . top ) ;
1806
1809
}
1807
1810
1808
1811
function _getSwapDirection ( evt , target , targetRect , vertical , swapThreshold , invertedSwapThreshold , invertSwap , isLastTarget ) {
0 commit comments