draggable, droppable: added a class do the active draggable helper, that will be ignored by droppables as droppable target (fixes #2886)

This commit is contained in:
Paul Bakaus 2008-05-25 16:50:18 +00:00
parent 0f9bb627ee
commit 57266e1ba4
2 changed files with 3 additions and 1 deletions

View File

@ -118,6 +118,7 @@
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };//Recache the helper size
if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e); if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
this.helper.addClass("ui-draggable-dragging");
this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position this.mouseDrag(e); //Execute the drag once - this causes the helper not to be visible before getting its correct position
return true; return true;
}, },
@ -223,6 +224,7 @@
return false; return false;
}, },
clear: function() { clear: function() {
this.helper.removeClass("ui-draggable-dragging");
if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove(); if(this.options.helper != 'original' && !this.cancelHelperRemoval) this.helper.remove();
if($.ui.ddmanager) $.ui.ddmanager.current = null; if($.ui.ddmanager) $.ui.ddmanager.current = null;
this.helper = null; this.helper = null;

View File

@ -96,7 +96,7 @@
if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
var childrenIntersection = false; var childrenIntersection = false;
this.element.find(".ui-droppable").each(function() { this.element.find(".ui-droppable").not(".ui-draggable-dragging").each(function() {
var inst = $.data(this, 'droppable'); var inst = $.data(this, 'droppable');
if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) { if(inst.options.greedy && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)) {
childrenIntersection = true; return false; childrenIntersection = true; return false;