diff --git a/scrollbar.go b/scrollbar.go index 799ef3e..28f66eb 100644 --- a/scrollbar.go +++ b/scrollbar.go @@ -141,19 +141,15 @@ func (this *Scrollbar) handleKeyUp (key input.Key, numpad bool) bool { switch key { case input.KeyUp, input.KeyLeft: return true case input.KeyDown, input.KeyRight: return true - case input.KeyHome: return true - case input.KeyEnd: return true + case input.KeyPageUp: return true + case input.KeyPageDown: return true + case input.KeyHome: return true + case input.KeyEnd: return true } return false } func (this *Scrollbar) handleKeyDown (key input.Key, numpad bool) bool { - var increment float64; if this.layout.vertical { - increment = -0.05 - } else { - increment = 0.05 - } - modifiers := this.Window().Modifiers() switch key { @@ -161,15 +157,20 @@ func (this *Scrollbar) handleKeyDown (key input.Key, numpad bool) bool { if modifiers.Alt { this.SetValue(0) } else { - this.SetValue(this.Value() - increment) + this.scrollBy(this.StepSize()) } return true case input.KeyDown, input.KeyRight: if modifiers.Alt { this.SetValue(1) } else { - this.SetValue(this.Value() + increment) + this.scrollBy(-this.StepSize()) } + case input.KeyPageUp: + this.scrollBy(this.PageSize()) + return true + case input.KeyPageDown: + this.scrollBy(-this.PageSize()) return true case input.KeyHome: this.SetValue(0)