add PageUp / PageDown scrolling
This commit is contained in:
@@ -200,14 +200,24 @@ func (b *BrowsingPane) SelectAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *BrowsingPane) ScrollUp() {
|
func (b *BrowsingPane) ScrollUp() {
|
||||||
if s, ok := b.curPage.(Scrollable); ok {
|
b.scrollBy(-75)
|
||||||
s.Scroll(-75)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BrowsingPane) ScrollDown() {
|
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 {
|
if s, ok := b.curPage.(Scrollable); ok {
|
||||||
s.Scroll(75)
|
s.Scroll(increment)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -383,6 +383,10 @@ func (m *MainWindow) addShortcuts() {
|
|||||||
m.BrowsingPane.ScrollUp()
|
m.BrowsingPane.ScrollUp()
|
||||||
case fyne.KeyDown:
|
case fyne.KeyDown:
|
||||||
m.BrowsingPane.ScrollDown()
|
m.BrowsingPane.ScrollDown()
|
||||||
|
case fyne.KeyPageUp:
|
||||||
|
m.BrowsingPane.PageUp()
|
||||||
|
case fyne.KeyPageDown:
|
||||||
|
m.BrowsingPane.PageDown()
|
||||||
case fyne.KeyEscape:
|
case fyne.KeyEscape:
|
||||||
m.Controller.CloseEscapablePopUp()
|
m.Controller.CloseEscapablePopUp()
|
||||||
case fyne.KeySpace:
|
case fyne.KeySpace:
|
||||||
|
|||||||
Reference in New Issue
Block a user