Skip to content
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

Fix(infinite list): move visible elements when an update occurs offscreen before them #2442

Conversation

alex-ds13
Copy link
Contributor

This fix is related to a bug on the branch feature/list-widget-reloaded:

  • When there is a Change::Update on an element that isn't visible it wasn't moving the layouts, however when that element is before the ones visible they need to be moved or else they will be on the wrong position if there was a height change.
  • TODO: maybe all this layout moving and offset calculation logic should only be run if height_difference was different than 0. Since when it is 0 it changes nothing. Sometimes this update changes are only value updates that don't change the height, so there is no point in doing it in those cases.

I was going to tell you about this on Discord but since you weren't online I thought there was no harm in doing this PR anyway since I had already made the fix and tried it. Feel free to make your own fix if you prefer.

- When there is a `Change::Update` on an element that isn't visible it
  wasn't moving the layouts, however when that element is before the
  ones visible they need to be moved or else they will be on the wrong
  position if there was a height change.
- TODO: maybe all this layout moving and offset calculation logic should
  only be run if `height_difference` was different than 0. Since when it
  is 0 it changes nothing. Sometimes this update changes are only value
  updates that don't change the height, so there is no point in doing it.
@alex-ds13 alex-ds13 force-pushed the feature/list-widget-reloaded branch from 478c41f to f683067 Compare May 16, 2024 21:44
@alex-ds13 alex-ds13 changed the title Fix(inifinite list): move visible elements when an update occurs offscreen before them Fix(infinite list): move visible elements when an update occurs offscreen before them May 16, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable. Thanks! 🙇

@hecrj hecrj added bug Something isn't working widget layout fix labels May 18, 2024
@hecrj hecrj added this to the 0.13 milestone May 18, 2024
@hecrj hecrj merged commit db828a7 into iced-rs:feature/list-widget-reloaded May 18, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix layout widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants