ui-core: added mouseCapture, replacing the condition feature before. Allows text to be selected in sortables on non-handles.

This commit is contained in:
Paul Bakaus 2008-06-09 01:54:28 +00:00
parent 8105c48065
commit 4b186675af
3 changed files with 12 additions and 6 deletions

View File

@ -199,7 +199,7 @@ $.ui.mouse = {
var self = this, var self = this,
btnIsLeft = (e.which == 1), btnIsLeft = (e.which == 1),
elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).is(this.options.cancel) : false); elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).is(this.options.cancel) : false);
if (!btnIsLeft || elIsCancel) { if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) {
return true; return true;
} }
@ -277,7 +277,8 @@ $.ui.mouse = {
// These are placeholder methods, to be overriden by extending plugin // These are placeholder methods, to be overriden by extending plugin
mouseStart: function(e) {}, mouseStart: function(e) {},
mouseDrag: function(e) {}, mouseDrag: function(e) {},
mouseStop: function(e) {} mouseStop: function(e) {},
mouseCapture: function(e) { return true; }
}; };
$.ui.mouse.defaults = { $.ui.mouse.defaults = {

View File

@ -504,6 +504,7 @@ $.ui.plugin.add("draggable", "connectToSortable", {
this.instance.options.helper = function() { return ui.helper[0]; }; this.instance.options.helper = function() { return ui.helper[0]; };
e.target = this.instance.currentItem[0]; e.target = this.instance.currentItem[0];
this.instance.mouseCapture(e, true, true);
this.instance.mouseStart(e, true, 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 //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes

View File

@ -276,10 +276,7 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
}; };
}, },
mouseStart: function(e, overrideHandle, noActivation) { mouseCapture: function(e, overrideHandle) {
var o = this.options;
this.currentContainer = this;
if(this.options.disabled || this.options.type == 'static') return false; if(this.options.disabled || this.options.type == 'static') return false;
@ -300,6 +297,13 @@ $.widget("ui.sortable", $.extend($.ui.mouse, {
} }
this.currentItem = currentItem; this.currentItem = currentItem;
return true;
},
mouseStart: function(e, overrideHandle, noActivation) {
var o = this.options;
this.currentContainer = this;
this.refresh(); this.refresh();