io/router: simplify pointer event routing

- Drop pointer.Event.Hit in favour of Enter/Leave events.
- Track enter/leaves for each pointer.ID (updates #122). Add test.
- Resolve grabs once.
- Get rid of scratch slice.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-31 13:43:33 +02:00
parent 23c2d44b8c
commit 3b28c5d067
4 changed files with 139 additions and 113 deletions
+1 -1
View File
@@ -145,7 +145,7 @@ func (c *Click) Events(q event.Queue) []ClickEvent {
case pointer.Cancel:
c.state = StateNormal
case pointer.Press:
if c.state == StatePressed || !e.Hit {
if c.state == StatePressed {
break
}
if e.Source == pointer.Mouse && e.Buttons != pointer.ButtonLeft {