/*
* sortable_core.js
- */
\ No newline at end of file
+ */
+
+(function( $ ) {
+
+module( "sortable: core" );
+
+test( "#9314: Sortable: Items cannot be dragged directly into bottom position", function() {
+ expect( 1 );
+
+ var el = $( ".connectWith" ).sortable({
+ connectWith: ".connectWith"
+ });
+
+ TestHelpers.sortable.sort( $( "li", el[ 1 ] )[ 0 ], 0, -12, 5, "Dragging the sortable into connected sortable" );
+});
+
+})( jQuery );
},
_contactContainers: function(event) {
- var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, base, cur, nearBottom, floating,
+ var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, floating, axis,
innermostContainer = null,
innermostIndex = null;
floating = innermostContainer.floating || this._isFloating(this.currentItem);
posProperty = floating ? "left" : "top";
sizeProperty = floating ? "width" : "height";
- base = this.positionAbs[posProperty] + this.offset.click[posProperty];
+ axis = floating ? "clientX" : "clientY";
+
for (j = this.items.length - 1; j >= 0; j--) {
if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) {
continue;
if(this.items[j].item[0] === this.currentItem[0]) {
continue;
}
- if (floating && !this._isOverAxis(this.positionAbs.top + this.offset.click.top, this.items[j].top, this.items[j].height)) {
- continue;
- }
+
cur = this.items[j].item.offset()[posProperty];
nearBottom = false;
- if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
+ if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) {
nearBottom = true;
- cur += this.items[j][sizeProperty];
}
- if(Math.abs(cur - base) < dist) {
- dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+ if ( Math.abs( event[ axis ] - cur ) < dist ) {
+ dist = Math.abs( event[ axis ] - cur );
+ itemWithLeastDistance = this.items[ j ];
this.direction = nearBottom ? "up": "down";
}
}