]> 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:39 +0000 (08:31 -0500)
(cherry picked from commit 35dd0417bdb442ad00a9eb37a85db5ddf1b14615)

ui/jquery.ui.selectable.js

index 19ed1fbd7e3d46641d6206ae2679a33b4598dee7..5a02f551a22ebfb9932cc057a434b2540905c743 100644 (file)
@@ -103,7 +103,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');
@@ -118,7 +118,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");
@@ -188,7 +188,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');
@@ -207,7 +207,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;