aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.sortable.js
diff options
context:
space:
mode:
authorPaul Bakaus <paul.bakaus@googlemail.com>2008-07-09 09:03:24 +0000
committerPaul Bakaus <paul.bakaus@googlemail.com>2008-07-09 09:03:24 +0000
commitcf48fc7ee4fad5a641d675265afbe4573f55fb72 (patch)
tree14f41cc4253b0f17e752e9e433e9e7429e84559e /ui/ui.sortable.js
parenta8c39c29e27f9df3e474d7e5937d29dd664414eb (diff)
downloadjquery-ui-cf48fc7ee4fad5a641d675265afbe4573f55fb72.tar.gz
jquery-ui-cf48fc7ee4fad5a641d675265afbe4573f55fb72.zip
sortable: added forcePointerForContainers option (to have another intersection mode for items, but allow only one container to be activated at the same time), added custom object in options, that holds custom (defined) functions that are called instead of original pieces. Only for advanced developers, currently only supported function: refreshContainers.
Diffstat (limited to 'ui/ui.sortable.js')
-rw-r--r--ui/ui.sortable.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js
index 0fd46d152..6d33bf98c 100644
--- a/ui/ui.sortable.js
+++ b/ui/ui.sortable.js
@@ -92,7 +92,7 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
var l = item.left, r = l + item.width,
t = item.top, b = t + item.height;
- if(this.options.tolerance == "pointer" || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
+ if(this.options.tolerance == "pointer" || this.options.forcePointerForContainers || (this.options.tolerance == "guess" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])) {
return (y1 + this.offset.click.top > t && y1 + this.offset.click.top < b && x1 + this.offset.click.left > l && x1 + this.offset.click.left < r);
} else {
@@ -206,15 +206,19 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, {
this.items[i].top = p.top;
};
-
- for (var i = this.containers.length - 1; i >= 0; i--){
- var p =this.containers[i].element.offset();
- this.containers[i].containerCache.left = p.left;
- this.containers[i].containerCache.top = p.top;
- this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
- this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
- };
-
+
+ if(this.options.custom && this.options.custom.refreshContainers) {
+ this.options.custom.refreshContainers.call(this);
+ } else {
+ for (var i = this.containers.length - 1; i >= 0; i--){
+ var p =this.containers[i].element.offset();
+ this.containers[i].containerCache.left = p.left;
+ this.containers[i].containerCache.top = p.top;
+ this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
+ this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+ };
+ }
+
},
destroy: function() {
this.element