Skip to content

Commit

Permalink
add PageUp / PageDown scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Dec 5, 2024
1 parent 0936380 commit b0b34e7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ui/browsing/browsingpane.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,24 @@ func (b *BrowsingPane) SelectAll() {
}

func (b *BrowsingPane) ScrollUp() {
if s, ok := b.curPage.(Scrollable); ok {
s.Scroll(-75)
}
b.scrollBy(-75)
}

func (b *BrowsingPane) ScrollDown() {
b.scrollBy(75)
}

func (b *BrowsingPane) PageUp() {
b.scrollBy(-b.Size().Height * 0.9)
}

func (b *BrowsingPane) PageDown() {
b.scrollBy(b.Size().Height * 0.9)
}

func (b *BrowsingPane) scrollBy(increment float32) {
if s, ok := b.curPage.(Scrollable); ok {
s.Scroll(75)
s.Scroll(increment)
}
}

Expand Down
4 changes: 4 additions & 0 deletions ui/mainwindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ func (m *MainWindow) addShortcuts() {
m.BrowsingPane.ScrollUp()
case fyne.KeyDown:
m.BrowsingPane.ScrollDown()
case fyne.KeyPageUp:
m.BrowsingPane.PageUp()
case fyne.KeyPageDown:
m.BrowsingPane.PageDown()
case fyne.KeyEscape:
m.Controller.CloseEscapablePopUp()
case fyne.KeySpace:
Expand Down

0 comments on commit b0b34e7

Please sign in to comment.