mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
io/pointer: add InputOp.Types to specify which types of events to receive
Signed-off-by: Gordon Klaus <gordon.klaus@gmail.com>
This commit is contained in:
+17
-3
@@ -8,6 +8,23 @@ object such as a finger.
|
||||
The InputOp operation is used to declare a handler ready for pointer
|
||||
events. Use an event.Queue to receive events.
|
||||
|
||||
Types
|
||||
|
||||
Only events that match a specified list of types are delivered to a handler.
|
||||
|
||||
For example, to receive Press, Move, and Release events (but not Enter,
|
||||
Leave, or Scroll):
|
||||
|
||||
var ops op.Ops
|
||||
var h *Handler = ...
|
||||
|
||||
pointer.InputOp{
|
||||
Tag: h,
|
||||
Types: pointer.Press | pointer.Move | pointer.Release,
|
||||
}.Add(ops)
|
||||
|
||||
Cancel events are always delivered.
|
||||
|
||||
Areas
|
||||
|
||||
The area operations are used for specifying the area where
|
||||
@@ -15,9 +32,6 @@ subsequent InputOp are active.
|
||||
|
||||
For example, to set up a rectangular hit area:
|
||||
|
||||
var ops op.Ops
|
||||
var h *Handler = ...
|
||||
|
||||
r := image.Rectangle{...}
|
||||
pointer.Rect(r).Add(ops)
|
||||
pointer.InputOp{Tag: h}.Add(ops)
|
||||
|
||||
Reference in New Issue
Block a user