diff options
-rw-r--r-- | ui/source/ui.draggable.js | 32 | ||||
-rw-r--r-- | ui/source/ui.sortable.js | 15 |
2 files changed, 30 insertions, 17 deletions
diff --git a/ui/source/ui.draggable.js b/ui/source/ui.draggable.js index 64e206245..87fe09057 100644 --- a/ui/source/ui.draggable.js +++ b/ui/source/ui.draggable.js @@ -430,17 +430,22 @@ $.ui.plugin.add("draggable", "connectToSortable", {
start: function(e,ui) {
-
+
var inst = $(this).data("draggable");
inst.sortables = [];
$(ui.options.connectToSortable).each(function() {
- if($.data(this, 'sortable')) inst.sortables.push({
- instance: $.data(this, 'sortable'),
- offset: $.data(this, 'sortable').element.offset(),
- width: $.data(this, 'sortable').element.width(),
- height: $.data(this, 'sortable').element.height(),
- shouldRevert: $.data(this, 'sortable').options.revert
- });
+ if($.data(this, 'sortable')) {
+ var sortable = $.data(this, 'sortable');
+ inst.sortables.push({
+ instance: sortable,
+ offset: sortable.element.offset(),
+ width: sortable.element.width(),
+ height: sortable.element.height(),
+ shouldRevert: sortable.options.revert
+ });
+
+ sortable.propagate("activate", e, inst);
+ }
});
},
@@ -461,7 +466,10 @@ this.instance.element.triggerHandler("sortreceive", [e, $.extend(this.instance.ui(), { sender: inst.element })], this.instance.options["receive"]);
this.instance.options.helper = this.instance.options._helper;
+ } else {
+ this.instance.propagate("deactivate", e, inst);
}
+
});
},
@@ -473,17 +481,19 @@ var l = o.left, r = l + o.width,
t = o.top, b = t + o.height;
-
+
return (l < (this.positionAbs.left + this.offset.click.left) && (this.positionAbs.left + this.offset.click.left) < r
&& t < (this.positionAbs.top + this.offset.click.top) && (this.positionAbs.top + this.offset.click.top) < b);
};
- $.each(inst.sortables, function() {
+ $.each(inst.sortables, function(i) {
+
if(checkPos.call(inst, {
left: this.offset.left, top: this.offset.top,
width: this.width, height: this.height
})) {
+
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
if(!this.instance.isOver) {
this.instance.isOver = 1;
@@ -496,7 +506,7 @@ this.instance.options.helper = function() { return ui.helper[0]; };
e.target = this.instance.currentItem[0];
- this.instance.mouseStart(e, true);
+ this.instance.mouseStart(e, true, true);
//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
this.instance.offset.click.top = inst.offset.click.top;
diff --git a/ui/source/ui.sortable.js b/ui/source/ui.sortable.js index 7ab406a59..17287bb86 100644 --- a/ui/source/ui.sortable.js +++ b/ui/source/ui.sortable.js @@ -284,7 +284,7 @@ };
},
- mouseStart: function(e, overrideHandle) {
+ mouseStart: function(e, overrideHandle, noActivation) {
var o = this.options;
this.currentContainer = this;
@@ -385,7 +385,10 @@ this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
if(this.options.placeholder != 'clone') this.currentItem.css('visibility', 'hidden'); //Set the original element visibility to hidden to still fill out the white space
- for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i].propagate("activate", e, this); } //Post 'activate' events to possible containers
+
+ if(!noActivation) {
+ for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i].propagate("activate", e, this); } //Post 'activate' events to possible containers
+ }
//Prepare possible droppables
if($.ui.ddmanager) $.ui.ddmanager.current = this;
@@ -529,18 +532,18 @@ if(this.domPosition != this.currentItem.prev()[0]) this.propagate("update", e, null, noPropagation); //Trigger update callback if the DOM position has changed
if(!contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element
- this.propagate("remove", e);
+ this.propagate("remove", e, null, noPropagation);
for (var i = this.containers.length - 1; i >= 0; i--){
if(contains(this.containers[i].element[0], this.currentItem[0])) {
- this.containers[i].propagate("update", e, this);
- this.containers[i].propagate("receive", e, this);
+ this.containers[i].propagate("update", e, this, noPropagation);
+ this.containers[i].propagate("receive", e, this, noPropagation);
}
};
};
//Post events to containers
for (var i = this.containers.length - 1; i >= 0; i--){
- this.containers[i].propagate("deactivate", e, this);
+ this.containers[i].propagate("deactivate", e, this, noPropagation);
if(this.containers[i].containerCache.over) {
this.containers[i].propagate("out", e, this);
this.containers[i].containerCache.over = 0;
|