Compare commits

...

2 Commits

2 changed files with 27 additions and 0 deletions

View File

@ -104,6 +104,29 @@ func (this *ScrollContainer) SetRoot (root tomo.ContentBox) {
}
}
// SetValue sets the horizontal and vertical scrollbar values where 0 is all the
// way to the left/top, and 1 is all the way to the right/bottom.
func (this *ScrollContainer) SetValue (x, y float64) {
if this.layout.horizontal != nil {
this.layout.horizontal.SetValue(x)
}
if this.layout.vertical != nil {
this.layout.vertical.SetValue(y)
}
}
// Value returns the horizontal and vertical scrollbar values where 0 is all the
// way to the left/top, and 1 is all the way to the right/bottom.
func (this *ScrollContainer) Value () (x, y float64) {
if this.layout.horizontal != nil {
x = this.layout.horizontal.Value()
}
if this.layout.vertical != nil {
y = this.layout.vertical.Value()
}
return x, y
}
func (this *ScrollContainer) handleScroll (x, y float64) {
if this.layout.root == nil { return }
this.layout.root.ScrollTo (

View File

@ -98,16 +98,20 @@ func (this *Slider) handleKeyDown (key input.Key, numpad bool) {
} else {
this.SetValue(this.Value() - increment)
}
this.on.slide.Broadcast()
case input.KeyDown, input.KeyRight:
if this.Modifiers().Alt {
this.SetValue(1)
} else {
this.SetValue(this.Value() + increment)
}
this.on.slide.Broadcast()
case input.KeyHome:
this.SetValue(0)
this.on.slide.Broadcast()
case input.KeyEnd:
this.SetValue(1)
this.on.slide.Broadcast()
}
}