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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rustbasic
Copy link
Contributor

Fix: scroll_with_delta() for ScrollArea::vertical() and ScrollArea::horizontal()

We need to do this in order for ScrollArea::vertical() and ScrollArea::horizontal() to work even where they are divided or nested.

Pull requests :

@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

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.

2 participants