]> source.dussan.org Git - jquery-ui.git/commitdiff
Fixed #3077 (Selectable cannot be selected by click)
authorRichard Worth <rdworth@gmail.com>
Fri, 16 Jan 2009 04:06:51 +0000 (04:06 +0000)
committerRichard Worth <rdworth@gmail.com>
Fri, 16 Jan 2009 04:06:51 +0000 (04:06 +0000)
ui/ui.selectable.js

index d8f86a40605cfdca8e83399ff14a44410128d65f..8228c95ce2c675a3ff629301b069e949c9073f6d 100644 (file)
@@ -33,8 +33,8 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
                                        $element: $this,
                                        left: pos.left,
                                        top: pos.top,
-                                       right: pos.left + $this.width(),
-                                       bottom: pos.top + $this.height(),
+                                       right: pos.left + $this.outerWidth(),
+                                       bottom: pos.top + $this.outerHeight(),
                                        startselected: false,
                                        selected: $this.hasClass('ui-selected'),
                                        selecting: $this.hasClass('ui-selecting'),
@@ -105,11 +105,21 @@ $.widget("ui.selectable", $.extend({}, $.ui.mouse, {
                        }
                });
 
-               var isSelectee = false;
                $(event.target).parents().andSelf().each(function() {
-                       if($.data(this, "selectable-item")) isSelectee = true;
+                       var selectee = $.data(this, "selectable-item");
+                       if (selectee) {
+                               selectee.$element.removeClass("ui-unselecting").addClass('ui-selecting');
+                               selectee.unselecting = false;
+                               selectee.selecting = true;
+                               selectee.selected = true;
+                               // selectable SELECTING callback
+                               self._trigger("selecting", event, {
+                                       selecting: selectee.element
+                               });
+                               return false;
+                       }
                });
-               return this.options.keyboard ? !isSelectee : true;
+
        },
 
        _mouseDrag: function(event) {
@@ -238,7 +248,7 @@ $.extend($.ui.selectable, {
                autoRefresh: true,
                cancel: ":input,option",
                delay: 0,
-               distance: 1,
+               distance: 0,
                filter: '*',
                tolerance: 'touch'
        }