Proper keyboard and mouse event propagation

This commit is contained in:
2023-04-14 19:08:14 -04:00
parent e931717241
commit 4c6f1f80e7
3 changed files with 103 additions and 69 deletions

View File

@@ -42,6 +42,22 @@ func (entity *entity) unbind () {
}
}
func (entity *entity) propagate (callback func (*entity) bool) {
for _, child := range entity.children {
if callback(child) { break }
child.propagate(callback)
}
}
func (entity *entity) childAt (point image.Point) *entity {
for _, child := range entity.children {
if point.In(child.bounds) {
return child
}
}
return entity
}
// ----------- Entity ----------- //
func (entity *entity) Invalidate () {
@@ -144,11 +160,11 @@ func (entity *entity) Focus () {
}
func (entity *entity) FocusNext () {
// TODO
entity.window.system.focusNext()
}
func (entity *entity) FocusPrevious () {
// TODO
entity.window.system.focusPrevious()
}
// ----------- FlexibleEntity ----------- //