aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.sortable.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-07-28 18:34:01 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-07-28 18:34:01 +0000
commit841751a0d5ce21bae6e2318f2d3d16b9a4748014 (patch)
tree1732e770b9444f3454c6aa199e7396a4e2110e20 /ui/ui.sortable.js
parent609699d9e987ae06f10b636ff7ee0c6ac8a582ff (diff)
downloadjquery-ui-841751a0d5ce21bae6e2318f2d3d16b9a4748014.tar.gz
jquery-ui-841751a0d5ce21bae6e2318f2d3d16b9a4748014.zip
1.8: initial version of tree component, dependant upon sortables and droppables
1.6: droppables can now operate in a seperate scope, droppables and sortables in the current dragged item are filtered out at start, preventing node hierarchy issues
Diffstat (limited to 'ui/ui.sortable.js')
-rw-r--r--ui/ui.sortable.js23
1 files changed, 20 insertions, 3 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js
index 803531f43..24c934852 100644
--- a/ui/ui.sortable.js
+++ b/ui/ui.sortable.js
@@ -127,7 +127,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
if ((x1 + dxClick) > l && (x1 + dxClick) < l + item.width/2) return 2;
if ((x1 + dxClick) > l + item.width/2 && (x1 + dxClick) < r) return 1;
} else {
- var height = item.height, helperHeight = this.helperProportions.height;
+ var height = item.height;
var direction = y1 - this.updateOriginalPosition.top < 0 ? 2 : 1; // 2 = up
if (direction == 1 && (y1 + dyClick) < t + height/2) { return 2; } // up
@@ -188,6 +188,21 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
},
+ removeCurrentsFromItems: function() {
+
+ var list = this.currentItem.find(":data(sortable-item)");
+
+ for (var i=0; i < this.items.length; i++) {
+
+ for (var j=0; j < list.length; j++) {
+ if(list[j] == this.items[i].item[0])
+ this.items.splice(i,1);
+ };
+
+ };
+
+ },
+
refreshItems: function() {
this.items = [];
@@ -371,6 +386,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
}
this.currentItem = currentItem;
+ this.removeCurrentsFromItems();
return true;
},
@@ -437,7 +453,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
//Call plugins and callbacks
this.propagate("start", e);
- this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
+ if(!this._preserveHelperProportions) this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
if(o.cursorAt) {
if(o.cursorAt.left != undefined) this.offset.click.left = o.cursorAt.left;
@@ -705,7 +721,8 @@ $.extend($.ui.sortable, {
zIndex: 1000,
dropOnEmpty: true,
appendTo: "parent",
- sortIndicator: $.ui.sortable.prototype.rearrange
+ sortIndicator: $.ui.sortable.prototype.rearrange,
+ scope: "default"
}
});