]> source.dussan.org Git - jquery-ui.git/commitdiff
ui-core: added mouseCapture, replacing the condition feature before. Allows text...
authorPaul Bakaus <paul.bakaus@googlemail.com>
Mon, 9 Jun 2008 01:54:28 +0000 (01:54 +0000)
committerPaul Bakaus <paul.bakaus@googlemail.com>
Mon, 9 Jun 2008 01:54:28 +0000 (01:54 +0000)
ui/ui.core.js
ui/ui.draggable.js
ui/ui.sortable.js

index 1e8fa48b97e3a577635fca75d3dd3ed69e4c690d..2c668a62ed860ec9afacef280cfd1585406e3fc8 100644 (file)
@@ -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 = {
index 12a3a6e9bd5c45cbe0fdcfd4a669584d0fc5ae97..dbe2495c66ca8e297f05f9d8416a27e56325d4f7 100644 (file)
@@ -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
index 9718dd1bc9b50b0a0e5e8bc6454fed4a8d9b01ca..4cc200bef8c4c34eb33bc5443361b61e6dcf2207 100644 (file)
@@ -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();