-
Notifications
You must be signed in to change notification settings - Fork 450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8178297: TableView scrolls slightly when adding new elements #297
Conversation
…are added to the virtualFlow.
👋 Welcome back jpereda! A progress list of the required criteria for merging this PR into |
/reviewers 2 |
@kevinrushforth |
@jperedadnr this pull request can not be integrated into git checkout 8178297-virtualflow
git fetch https://git.openjdk.java.net/jfx master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@jperedadnr This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 7 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
@jperedadnr Since your change was applied there have been 7 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 205e4b9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This PR fixes an issue that happens when adding new items to a
TableView
or any other control that usesVirtualFlow
, if the scroll position is not 0: the virtual flow is slightly shifted down.For instance, let's say that a cell has a layoutY of -10.0. After adding a new item to the table, during the layout pass the new value is initially modified to -9.999999999999996 (
VirtualFlow::adjustByPixelAmount
) , and then, after callingVirtualFlow::positionCell
(that usessnapSizeY(position)
) the layoutY is modified to -9.5, causing an undesired positive shift of 0.5 pixels.Region
has different snap methods:snapSizeX/Y
are used to snap node dimension values, like width or height, by ceiling to the nearest pixel (which explains the -9.5 value), whilesnapSpaceX/Y
are used to snap position values like insets, by rounding to the nearest pixel (this will give the expected -10.0).Therefore, this PR modifies
VirtualFlow::positionCell
to use thesnapSpaceX/Y
methods, since these are being used to set the layout of the cell and not its size.Test: A unity test has been included. It simulates the case of adding new items to the virtual flow after an initial scroll.
It currently fails after adding a few items, and it passes with the changes of this PR.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/297/head:pull/297
$ git checkout pull/297