Fix keys for Scrollbar

This commit is contained in:
Sasha Koshka 2024-07-27 00:54:40 -04:00
parent 9fa764c7b9
commit c8d33a0ef4

View File

@ -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)