diff options
Diffstat (limited to 'ui/jquery.ui.sortable.js')
-rw-r--r-- | ui/jquery.ui.sortable.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ui/jquery.ui.sortable.js b/ui/jquery.ui.sortable.js index 563e63c09..c1566fd58 100644 --- a/ui/jquery.ui.sortable.js +++ b/ui/jquery.ui.sortable.js @@ -1,7 +1,7 @@ -/* +/*! * jQuery UI Sortable @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * @@ -16,6 +16,7 @@ $.widget("ui.sortable", $.ui.mouse, { widgetEventPrefix: "sort", + ready: false, options: { appendTo: "parent", axis: false, @@ -57,10 +58,14 @@ $.widget("ui.sortable", $.ui.mouse, { //Initialize mouse events for interaction this._mouseInit(); + + //We're ready to go + this.ready = true }, destroy: function() { + $.Widget.prototype.destroy.call( this ); this.element .removeClass("ui-sortable ui-sortable-disabled"); this._mouseDestroy(); @@ -463,8 +468,8 @@ $.widget("ui.sortable", $.ui.mouse, { _intersectsWithPointer: function(item) { - var isOverElementHeight = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), - isOverElementWidth = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), + var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height), + isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width), isOverElement = isOverElementHeight && isOverElementWidth, verticalDirection = this._getDragVerticalDirection(), horizontalDirection = this._getDragHorizontalDirection(); @@ -571,7 +576,7 @@ $.widget("ui.sortable", $.ui.mouse, { var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]]; var connectWith = this._connectWith(); - if(connectWith) { + if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down for (var i = connectWith.length - 1; i >= 0; i--){ var cur = $(connectWith[i]); for (var j = cur.length - 1; j >= 0; j--){ |