diff options
author | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-06-09 01:54:28 +0000 |
---|---|---|
committer | Paul Bakaus <paul.bakaus@googlemail.com> | 2008-06-09 01:54:28 +0000 |
commit | 4b186675af2dd02878b538de212780f3df102ae3 (patch) | |
tree | ad3f3ae43f5dd7776fb236e698c5e2d40c6be704 /ui | |
parent | 8105c48065df87218c7df40dd630b5ed0f3ecd5c (diff) | |
download | jquery-ui-4b186675af2dd02878b538de212780f3df102ae3.tar.gz jquery-ui-4b186675af2dd02878b538de212780f3df102ae3.zip |
ui-core: added mouseCapture, replacing the condition feature before. Allows text to be selected in sortables on non-handles.
Diffstat (limited to 'ui')
-rw-r--r-- | ui/ui.core.js | 5 | ||||
-rw-r--r-- | ui/ui.draggable.js | 1 | ||||
-rw-r--r-- | ui/ui.sortable.js | 12 |
3 files changed, 12 insertions, 6 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 1e8fa48b9..2c668a62e 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -199,7 +199,7 @@ $.ui.mouse = { var self = this, btnIsLeft = (e.which == 1), elIsCancel = (typeof this.options.cancel == "string" ? $(e.target).is(this.options.cancel) : false); - if (!btnIsLeft || elIsCancel) { + if (!btnIsLeft || elIsCancel || !this.mouseCapture(e)) { return true; } @@ -277,7 +277,8 @@ $.ui.mouse = { // These are placeholder methods, to be overriden by extending plugin mouseStart: function(e) {}, mouseDrag: function(e) {}, - mouseStop: function(e) {} + mouseStop: function(e) {}, + mouseCapture: function(e) { return true; } }; $.ui.mouse.defaults = { diff --git a/ui/ui.draggable.js b/ui/ui.draggable.js index 12a3a6e9b..dbe2495c6 100644 --- a/ui/ui.draggable.js +++ b/ui/ui.draggable.js @@ -504,6 +504,7 @@ $.ui.plugin.add("draggable", "connectToSortable", { this.instance.options.helper = function() { return ui.helper[0]; }; e.target = this.instance.currentItem[0]; + this.instance.mouseCapture(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 diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index 9718dd1bc..4cc200bef 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -276,10 +276,7 @@ $.widget("ui.sortable", $.extend($.ui.mouse, { }; }, - mouseStart: function(e, overrideHandle, noActivation) { - - var o = this.options; - this.currentContainer = this; + mouseCapture: function(e, overrideHandle) { if(this.options.disabled || this.options.type == 'static') return false; @@ -300,6 +297,13 @@ $.widget("ui.sortable", $.extend($.ui.mouse, { } this.currentItem = currentItem; + return true; + + }, + mouseStart: function(e, overrideHandle, noActivation) { + + var o = this.options; + this.currentContainer = this; this.refresh(); |