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: scroll_with_delta() for ScrollArea::vertical() and ScrollArea::horizontal() #5109

Closed
wants to merge 4 commits into from

Conversation

rustbasic
Copy link
Contributor

@rustbasic rustbasic commented Sep 14, 2024

@lucasmerlin
Copy link
Collaborator

The current behavior matches the behavior documented in scroll_with_delta:

Scroll this many points in the given direction, in the parent [crate::ScrollArea].

I think the current behavior makes sense and if you want to scroll the parent ScrollArea it should be possible by calling scroll_with_delta outside of the child ScrollArea.

@rustbasic
Copy link
Contributor Author

I think the current behavior makes sense and if you want to scroll the parent ScrollArea it should be possible by calling scroll_with_delta outside of the child ScrollArea.

It doesn't work when horizontal() and vertical() are separated.
Because the value is retrieved with take() and the value disappears,

ui.horizontal() {
  ui.vertical() {
    ScrollArea::vertical() {
      ui.label()
      ScrollArea::horizontal() {
      }
    }
  }
}

For example, if each line in TextEdit is numbered.

20240920

Copy link

Preview available at https://egui-pr-preview.github.io/pr/5109-patch123
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When moving with the animation function of ScrollArea, it does not move to the exact location.
2 participants