Search and Top Navigation
Ticket #4933: ui.droppable.patch
File ui.droppable.patch, 2.2 KB (added by silverj, December 11, 2009 03:18PM UTC)
Possible fix. drop() will only be called for the elements with highest z-index
Index: C:/projektid/private/scrumwall/src/main/webapp/js/jquery.ui-1.7.1/ui.droppable.js
===================================================================
--- C:/projektid/private/scrumwall/src/main/webapp/js/jquery.ui-1.7.1/ui.droppable.js (revision 155)
+++ C:/projektid/private/scrumwall/src/main/webapp/js/jquery.ui-1.7.1/ui.droppable.js (revision 156)
@@ -109,17 +109,40 @@
});
if(childrenIntersection) return false;
+
if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
- if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
- if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
- this._trigger('drop', event, this.ui(draggable));
- return this.element;
+ if(this.options.acceptFallthrough || this.isOnTop(draggable)){
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('drop', event, this.ui(draggable));
+
+ return this.element;
+ }
}
return false;
},
+ isOnTop: function(draggable){
+ var maxZIndex = parseInt($(this.element).css("z-index"));
+
+ $(":data(droppable)").not(".ui-draggable-dragging").each(function() {
+ var inst = $.data(this, 'droppable');
+ if($.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)){
+ var zIndex = $(this).css("z-index");
+ if(zIndex == "auto"){
+ zIndex = 0;
+ }
+ zIndex = parseInt(zIndex);
+ if(zIndex > maxZIndex) {
+ maxZIndex = zIndex
+ }
+ }
+ });
+
+ return maxZIndex == $(this.element).css("z-index");
+ },
ui: function(c) {
return {
draggable: (c.currentItem || c.element),
@@ -142,7 +165,8 @@
greedy: false,
hoverClass: false,
scope: 'default',
- tolerance: 'intersect'
+ tolerance: 'intersect',
+ acceptFallthrough: false
}
});
Download in other formats:
Original Format
File ui.droppable.patch, 2.2 KB (added by silverj, December 11, 2009 03:18PM UTC)
Possible fix. drop() will only be called for the elements with highest z-index
Index: C:/projektid/private/scrumwall/src/main/webapp/js/jquery.ui-1.7.1/ui.droppable.js
===================================================================
--- C:/projektid/private/scrumwall/src/main/webapp/js/jquery.ui-1.7.1/ui.droppable.js (revision 155)
+++ C:/projektid/private/scrumwall/src/main/webapp/js/jquery.ui-1.7.1/ui.droppable.js (revision 156)
@@ -109,17 +109,40 @@
});
if(childrenIntersection) return false;
+
if(this.options.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
- if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
- if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
- this._trigger('drop', event, this.ui(draggable));
- return this.element;
+ if(this.options.acceptFallthrough || this.isOnTop(draggable)){
+ if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+ if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+ this._trigger('drop', event, this.ui(draggable));
+
+ return this.element;
+ }
}
return false;
},
+ isOnTop: function(draggable){
+ var maxZIndex = parseInt($(this.element).css("z-index"));
+
+ $(":data(droppable)").not(".ui-draggable-dragging").each(function() {
+ var inst = $.data(this, 'droppable');
+ if($.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)){
+ var zIndex = $(this).css("z-index");
+ if(zIndex == "auto"){
+ zIndex = 0;
+ }
+ zIndex = parseInt(zIndex);
+ if(zIndex > maxZIndex) {
+ maxZIndex = zIndex
+ }
+ }
+ });
+
+ return maxZIndex == $(this.element).css("z-index");
+ },
ui: function(c) {
return {
draggable: (c.currentItem || c.element),
@@ -142,7 +165,8 @@
greedy: false,
hoverClass: false,
scope: 'default',
- tolerance: 'intersect'
+ tolerance: 'intersect',
+ acceptFallthrough: false
}
});