]> source.dussan.org Git - jquery-ui.git/commitdiff
Selectable: Explicitly check event.ctrlKey now that jQuery differentiates between...
authorScott González <scott.gonzalez@gmail.com>
Tue, 22 Nov 2011 13:31:11 +0000 (08:31 -0500)
committerScott González <scott.gonzalez@gmail.com>
Tue, 22 Nov 2011 13:31:11 +0000 (08:31 -0500)
ui/jquery.ui.selectable.js

index d7b24d4e399718c39403ef1af646d39f06a1cf60..408771eff7d708d1ef622e7c23b67ae29f115c75 100644 (file)
@@ -104,7 +104,7 @@ $.widget("ui.selectable", $.ui.mouse, {
                this.selectees.filter('.ui-selected').each(function() {
                        var selectee = $.data(this, "selectable-item");
                        selectee.startselected = true;
-                       if (!event.metaKey) {
+                       if (!event.metaKey && !event.ctrlKey) {
                                selectee.$element.removeClass('ui-selected');
                                selectee.selected = false;
                                selectee.$element.addClass('ui-unselecting');
@@ -119,7 +119,7 @@ $.widget("ui.selectable", $.ui.mouse, {
                $(event.target).parents().andSelf().each(function() {
                        var selectee = $.data(this, "selectable-item");
                        if (selectee) {
-                               var doSelect = !event.metaKey || !selectee.$element.hasClass('ui-selected');
+                               var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
                                selectee.$element
                                        .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
                                        .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
@@ -189,7 +189,7 @@ $.widget("ui.selectable", $.ui.mouse, {
                        } else {
                                // UNSELECT
                                if (selectee.selecting) {
-                                       if (event.metaKey && selectee.startselected) {
+                                       if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
                                                selectee.$element.removeClass('ui-selecting');
                                                selectee.selecting = false;
                                                selectee.$element.addClass('ui-selected');
@@ -208,7 +208,7 @@ $.widget("ui.selectable", $.ui.mouse, {
                                        }
                                }
                                if (selectee.selected) {
-                                       if (!event.metaKey && !selectee.startselected) {
+                                       if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
                                                selectee.$element.removeClass('ui-selected');
                                                selectee.selected = false;