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

Add tap-to-scroll to the scroll bars #5349

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
correct max scroll offset for the bottom/right of the content
  • Loading branch information
dweymouth committed Jan 1, 2025
commit d714713f33c30b7284c8584aa047aa6bb13ab0f0
6 changes: 4 additions & 2 deletions internal/widget/scroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,15 @@ func (a *scrollBarArea) Tapped(e *fyne.PointEvent) {
if e.Position.X < a.barLeadingEdge {
newOffset.X = fyne.Max(0, newOffset.X-a.scroll.Size().Width*pageScrollFraction)
} else if e.Position.X > a.barTrailingEdge {
newOffset.X = fyne.Min(a.scroll.Content.Size().Width, newOffset.X+a.scroll.Size().Width*pageScrollFraction)
viewWid := a.scroll.Size().Width
newOffset.X = fyne.Min(a.scroll.Content.Size().Width-viewWid, newOffset.X+viewWid*pageScrollFraction)
}
default:
if e.Position.Y < a.barLeadingEdge {
newOffset.Y = fyne.Max(0, newOffset.Y-a.scroll.Size().Height*pageScrollFraction)
} else if e.Position.Y > a.barTrailingEdge {
newOffset.Y = fyne.Min(a.scroll.Content.Size().Height, newOffset.Y+a.scroll.Size().Height*pageScrollFraction)
viewHt := a.scroll.Size().Height
newOffset.Y = fyne.Min(a.scroll.Content.Size().Height-viewHt, newOffset.Y+viewHt*pageScrollFraction)
}
}
if newOffset == a.scroll.Offset {
Expand Down
Loading