Repository: flex-sdk Updated Branches: refs/heads/develop 1754c10c1 -> 75154b643
FLEX-34028: Removed 2 variables that were not being used and changed the event ctrlKey/shiftKey selection check to before the dragEnabled check. Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/75154b64 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/75154b64 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/75154b64 Branch: refs/heads/develop Commit: 75154b643aed70acf100f8098099e0d1491813bb Parents: 1754c10 Author: Mark Kessler <kesslerconsult...@gmail.com> Authored: Wed Aug 12 20:36:52 2015 -0400 Committer: Mark Kessler <kesslerconsult...@gmail.com> Committed: Wed Aug 12 20:36:52 2015 -0400 ---------------------------------------------------------------------- .../spark/src/spark/components/DataGrid.as | 45 ++++++++------------ 1 file changed, 18 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/75154b64/frameworks/projects/spark/src/spark/components/DataGrid.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/DataGrid.as b/frameworks/projects/spark/src/spark/components/DataGrid.as index 5bc516f..fb0676f 100644 --- a/frameworks/projects/spark/src/spark/components/DataGrid.as +++ b/frameworks/projects/spark/src/spark/components/DataGrid.as @@ -862,16 +862,7 @@ public class DataGrid extends SkinnableContainerBase * comitting the selection until mouse up. */ private var pendingSelectionOnMouseUp:Boolean = false; - - /** - * @private - */ - private var pendingSelectionShiftKey:Boolean; - - /** - * @private - */ - private var pendingSelectionCtrlKey:Boolean; + //-------------------------------------------------------------------------- // @@ -5628,29 +5619,23 @@ public class DataGrid extends SkinnableContainerBase // position. if (rowIndex == -1 || isCellSelection && columnIndex == -1) return; - - if (event.ctrlKey == false && dragEnabled && isRowSelectionMode() && selectionContainsIndex(rowIndex)) + + + if (event.ctrlKey) { - pendingSelectionOnMouseUp = true; - pendingSelectionShiftKey = event.shiftKey; - pendingSelectionCtrlKey = event.ctrlKey; + // ctrl-click toggles the selection and updates caret and anchor. + if (!toggleSelection(rowIndex, columnIndex)) + return; + + grid.anchorRowIndex = rowIndex; + grid.anchorColumnIndex = columnIndex; } else { - if (event.ctrlKey) - { - // ctrl-click toggles the selection and updates caret and anchor. - if (!toggleSelection(rowIndex, columnIndex)) - return; - - grid.anchorRowIndex = rowIndex; - grid.anchorColumnIndex = columnIndex; - } - else if (event.shiftKey) + if (event.shiftKey) { // shift-click extends the selection and updates the caret. - if (grid.selectionMode == GridSelectionMode.MULTIPLE_ROWS || - grid.selectionMode == GridSelectionMode.MULTIPLE_CELLS) + if (grid.selectionMode == GridSelectionMode.MULTIPLE_ROWS || grid.selectionMode == GridSelectionMode.MULTIPLE_CELLS) { if (!extendSelection(rowIndex, columnIndex)) return; @@ -5662,6 +5647,12 @@ public class DataGrid extends SkinnableContainerBase setSelectionAnchorCaret(rowIndex, columnIndex); } } + + + if (dragEnabled && isRowSelectionMode() && selectionContainsIndex(rowIndex)) + { + pendingSelectionOnMouseUp = true; + } // If selection is pending on mouse up then we have just moused down on // an item, part of an already commited selection.