Scrolling over a ScrollContainer will now scroll it

This commit is contained in:
2023-04-16 14:12:55 -04:00
parent b9c8350677
commit 7d4ddaf387
4 changed files with 49 additions and 9 deletions

View File

@@ -81,6 +81,21 @@ func (entity *entity) childAt (point image.Point) *entity {
return entity
}
func (entity *entity) scrollTargetChildAt (point image.Point) *entity {
for _, child := range entity.children {
if point.In(child.bounds) {
result := child.scrollTargetChildAt(point)
if result != nil { return result }
break
}
}
if _, ok := entity.element.(tomo.ScrollTarget); ok {
return entity
}
return nil
}
// ----------- Entity ----------- //
func (entity *entity) Invalidate () {