FLEX-35260 GridHeaderViewLayout.getHeaderIndexAt() (which calls GridDimensions.getColumnIndexAt()) used to return a valid headerIndex (when it was expected to return -1) for an y < 0. Fixed.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/f985937c Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/f985937c Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/f985937c Branch: refs/heads/master Commit: f985937c08a261e8da91c0fc8a905ca0ddbbc842 Parents: 2adccce Author: Mihai Chira <mih...@apache.org> Authored: Fri Mar 10 18:21:44 2017 +0100 Committer: Mihai Chira <mih...@apache.org> Committed: Fri Mar 10 18:21:44 2017 +0100 ---------------------------------------------------------------------- .../gridClasses/GridDimensionsView.as | 4 ++-- .../gridClasses/GridHeaderViewLayout.as | 25 +++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f985937c/frameworks/projects/spark/src/spark/components/gridClasses/GridDimensionsView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/gridClasses/GridDimensionsView.as b/frameworks/projects/spark/src/spark/components/gridClasses/GridDimensionsView.as index fe7b55a..e5444a6 100644 --- a/frameworks/projects/spark/src/spark/components/gridClasses/GridDimensionsView.as +++ b/frameworks/projects/spark/src/spark/components/gridClasses/GridDimensionsView.as @@ -225,9 +225,9 @@ public class GridDimensionsView return rowIndex >= 0 ? rowIndex : -1; } - public function getColumnIndexAt(viewX:Number, viewY:Number):int + public function getColumnIndexAt(localX:Number, localY:Number):int { - const columnIndex:int = gridDimensions.getColumnIndexAt(viewX + viewOriginX, viewY + viewOriginY) - viewColumnIndex; + const columnIndex:int = gridDimensions.getColumnIndexAt(localX + viewOriginX, localY + viewOriginY) - viewColumnIndex; return columnIndex >= 0 ? columnIndex : -1; } http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/f985937c/frameworks/projects/spark/src/spark/components/gridClasses/GridHeaderViewLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/gridClasses/GridHeaderViewLayout.as b/frameworks/projects/spark/src/spark/components/gridClasses/GridHeaderViewLayout.as index 4dd36b8..ef79a02 100644 --- a/frameworks/projects/spark/src/spark/components/gridClasses/GridHeaderViewLayout.as +++ b/frameworks/projects/spark/src/spark/components/gridClasses/GridHeaderViewLayout.as @@ -503,21 +503,24 @@ public class GridHeaderViewLayout extends LayoutBase var headerIndex:int = -1; var globalPoint:Point = gridColumnHeaderGroup.localToGlobal(new Point(x, y)); - if(!gridColumnHeaderGroup.areCoordinatesOverLeftPadding(globalPoint)) + if(gridColumnHeaderGroup.containsGlobalCoordinates(globalPoint)) { - var paddingLeftStyle:Number = gridColumnHeaderGroup.getStyle("paddingLeft"); - var paddingLeft:Number = isNaN(paddingLeftStyle) ? 0 : paddingLeftStyle; - - headerIndex = gridView.gridViewLayout.gridDimensionsView.getColumnIndexAt(x - paddingLeft + horizontalScrollPosition, y); - - if(headerIndex == -1 && gridColumnHeaderGroup.containsGlobalCoordinates(globalPoint)) + if(!gridColumnHeaderGroup.areCoordinatesOverLeftPadding(globalPoint)) { - //then the point is either over the right padding, over the width of the vertical - //scroll bar, or over the space between the last separator and the width of the grid - headerIndex = grid.getPreviousVisibleColumnIndex(columnsView.length); + var paddingLeftStyle:Number = gridColumnHeaderGroup.getStyle("paddingLeft"); + var paddingLeft:Number = isNaN(paddingLeftStyle) ? 0 : paddingLeftStyle; + + headerIndex = gridView.gridViewLayout.gridDimensionsView.getColumnIndexAt(x - paddingLeft + horizontalScrollPosition, y); + + if(headerIndex == -1) + { + //then the point is either over the right padding, over the width of the vertical + //scroll bar, or over the space between the last separator and the width of the grid + headerIndex = grid.getPreviousVisibleColumnIndex(columnsView.length); + } } } - + return headerIndex; }