add PageUp / PageDown scrolling

This commit is contained in:
Drew Weymouth
2024-12-05 08:20:06 -08:00
parent 0936380fbc
commit b0b34e7791
2 changed files with 18 additions and 4 deletions
+14 -4
View File
@@ -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)
}
}
+4
View File
@@ -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: