Add Value and SetValue to ScrollContainer
This commit is contained in:
parent
dca1eaefb5
commit
8134069e1f
@ -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) {
|
func (this *ScrollContainer) handleScroll (x, y float64) {
|
||||||
if this.layout.root == nil { return }
|
if this.layout.root == nil { return }
|
||||||
this.layout.root.ScrollTo (
|
this.layout.root.ScrollTo (
|
||||||
|
Loading…
Reference in New Issue
Block a user