Scrollbars accept both directions of scroll

This commit is contained in:
Sasha Koshka 2024-07-26 21:01:18 -04:00
parent 4fc44c11e8
commit 2722d19ecd

View File

@ -235,6 +235,16 @@ func (this *Scrollbar) handleMouseMove () bool {
func (this *Scrollbar) handleScroll (x, y float64) bool { func (this *Scrollbar) handleScroll (x, y float64) bool {
if this.layout.linked == nil { return false } if this.layout.linked == nil { return false }
delta := (x + y)
if this.layout.vertical {
x = 0
y = delta
} else {
x = delta
y = 0
}
this.layout.linked.ScrollTo ( this.layout.linked.ScrollTo (
this.layout.linked.ContentBounds().Min. this.layout.linked.ContentBounds().Min.
Sub(image.Pt(int(x), int(y)))) Sub(image.Pt(int(x), int(y))))