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 ScrollToBottom and ScrollToTop #4492

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: [fyne-io, andydotxyz, toaster, Jacalz, changkun]
github: [fyne-io, andydotxyz, toaster, Jacalz, changkun, dweymouth]
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ More detailed release notes can be found on the [releases page](https://github.c
* Reduce calls to C and repeated size checks in painter and driver code


## 2.4.2 - 21 November 2023
## 2.4.2 - 22 November 2023

### Fixed

Expand Down
7 changes: 5 additions & 2 deletions internal/widget/scroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,16 @@ func (s *Scroll) CreateRenderer() fyne.WidgetRenderer {

// ScrollToBottom will scroll content to container bottom - to show latest info which end user just added
func (s *Scroll) ScrollToBottom() {
if s.Content.MinSize().Height > s.Size().Height {
s.Offset.Y = s.Content.MinSize().Height - s.Size().Height
s.Base.Refresh()
}
s.scrollBy(0, -1*(s.Content.MinSize().Height-s.Size().Height-s.Offset.Y))
s.Refresh()
}

// ScrollToTop will scroll content to container top
func (s *Scroll) ScrollToTop() {
s.scrollBy(0, -s.Offset.Y)
s.scrollBy(0, s.Offset.Y)
}

// DragEnd will stop scrolling on mobile has stopped
Expand Down