io/router: use areas to determine targets for synthetic clicks

Before this change, semantic clicks would be delivered according to
the center of the targeted widget, which could result in a different
widget receiving the click. Or in worst case, no widget in case the
center is not visible because of clipping.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-03-30 17:28:58 +02:00
parent 4326fee704
commit e8603ba59e
2 changed files with 22 additions and 2 deletions
+3 -2
View File
@@ -216,10 +216,11 @@ func (q *Router) ClickFocus() {
Position: f32.Pt(float32(center.X), float32(center.Y)),
Source: pointer.Touch,
}
area := q.key.queue.AreaFor(focus)
e.Type = pointer.Press
q.pointer.queue.Push(e, &q.handlers)
q.pointer.queue.Deliver(area, e, &q.handlers)
e.Type = pointer.Release
q.pointer.queue.Push(e, &q.handlers)
q.pointer.queue.Deliver(area, e, &q.handlers)
}
// TextInputState returns the input state from the most recent