Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the process of creating the union rects, the prior code has the assumption that the last element within a given set of elements is the has the lowest position. However, this assumption is not always correct. In the case where cells have varying heights, it is possible for another cell to have the lowest point. This results in the union rect not containing all the cells correctly. See picture:
The impact of this is that when scrolling past the bounds of the unionrect, the tall cell will disappear. Since the tall cell could be any one of the cells, from the first cell to the last one, the fix was to take the union of each cell in the group. It was tested and found that the performance degradation is approximately 5%.