all: make pointer.Area an interface

With an interface instead of anonymous functions, amending an
area's parameters can be done even after adding it to an OpHandler.

This will be useful when we switch to serialized op lists.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-04-24 15:39:53 +02:00
parent 3ad94ed20e
commit a8bb3c2f14
6 changed files with 34 additions and 28 deletions
+2 -2
View File
@@ -101,7 +101,7 @@ func (q *Queue) opHit(handlers *[]Key, op ui.Op, pos f32.Point) (HitResult, bool
return HitNone, false
}
tpos := h.transform.InvTransform(pos)
res := h.area(tpos)
res := h.area.Hit(tpos)
if res != HitNone {
*handlers = append(*handlers, op.Key)
}
@@ -229,7 +229,7 @@ func (q *Queue) Push(e Event) {
e.Priority = Foremost
}
e.Position = h.transform.InvTransform(e.Position)
e.Hit = h.area(e.Position) != HitNone
e.Hit = h.area.Hit(e.Position) != HitNone
h.events = append(h.events, e)
if e.Type == Release {
// Release grab when the number of grabs reaches zero.