palexdev / VirtualizedFX

GNU Lesser General Public License v3.0
46 stars 4 forks source link

Bug fix: grid state couldn't be updated when all rows are drawn, but there is additional space in the viewport. #8

Closed Alexander-Ploskin closed 1 year ago

Alexander-Ploskin commented 1 year ago

I use VirtualGrid in my project. When I change cell size in a way that maxRows becomes bigger than size() (GridState.rowsFilled() is false), the first row is collapsed. I found that this behavior is caused by GridState.init method, that doesn't do anything when the given ranges for rows and columns are the same. The target size also affects rows layout in my case, so the grid state should be updated in such case too. 56SJ8zpt1b

palexdev commented 1 year ago

@Alexander-Ploskin thank you very much, great to see people use this library Can you share a MRE first please? So that I can verify the bad behavior and also write tests for it

Alexander-Ploskin commented 1 year ago

@palexdev, thank you for a quick answer. The small project in attachment. To reproduce the issue follow steps in the gif. HdduwBwIex virtualgrid-bug.zip

palexdev commented 1 year ago

@Alexander-Ploskin nice catch for this nasty bug, the proposed fix was also really good, I just improved it a little to avoid unnecessary computations, see 9edb877b138c71a2511e78399ed2f6911887c54f New version will be out soon on Maven