mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 15:45:38 +00:00
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:
+2
-2
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user