package gesture
import "gioui.org/gesture"
Package gesture implements common pointer gestures.
Gestures accept low level pointer Events from an event Queue and detect higher level actions such as clicks and scrolling.
Index ¶
- type Axis
- type Click
- func (c *Click) Add(ops *op.Ops)
- func (c *Click) Events(q event.Queue) []ClickEvent
- func (c *Click) Hovered() bool
- func (c *Click) Pressed() bool
- type ClickEvent
- type ClickType
- type Drag
- func (d *Drag) Add(ops *op.Ops)
- func (d *Drag) Dragging() bool
- func (d *Drag) Events(cfg unit.Metric, q event.Queue, axis Axis) []pointer.Event
- func (d *Drag) Pressed() bool
- type Hover
- type Scroll
- func (s *Scroll) Add(ops *op.Ops, bounds image.Rectangle)
- func (s *Scroll) Scroll(cfg unit.Metric, q event.Queue, t time.Time, axis Axis) int
- func (s *Scroll) State() ScrollState
- func (s *Scroll) Stop()
- type ScrollState
Types ¶
type Axis ¶
type Axis uint8
func (Axis) String ¶
type Click ¶
type Click struct {
// contains filtered or unexported fields
}
Click detects click gestures in the form of ClickEvents.
func (*Click) Add ¶
Add the handler to the operation list to receive click events.
func (*Click) Events ¶
func (c *Click) Events(q event.Queue) []ClickEvent
Events returns the next click events, if any.
func (*Click) Hovered ¶
Hovered returns whether a pointer is inside the area.
func (*Click) Pressed ¶
Pressed returns whether a pointer is pressing.
type ClickEvent ¶
type ClickEvent struct { Type ClickType Position image.Point Source pointer.Source Modifiers key.Modifiers // NumClicks records successive clicks occurring // within a short duration of each other. NumClicks int }
ClickEvent represent a click action, either a TypePress for the beginning of a click or a TypeClick for a completed click.
func (ClickEvent) ImplementsEvent ¶
func (ClickEvent) ImplementsEvent()
type ClickType ¶
type ClickType uint8
const ( // TypePress is reported for the first pointer // press. TypePress ClickType = iota // TypeClick is reported when a click action // is complete. TypeClick // TypeCancel is reported when the gesture is // cancelled. TypeCancel )
func (ClickType) String ¶
type Drag ¶
type Drag struct {
// contains filtered or unexported fields
}
Drag detects drag gestures in the form of pointer.Drag events.
func (*Drag) Add ¶
Add the handler to the operation list to receive drag events.
func (*Drag) Dragging ¶
Dragging reports whether it is currently in use.
func (*Drag) Events ¶
Events returns the next drag events, if any.
func (*Drag) Pressed ¶
Pressed returns whether a pointer is pressing.
type Hover ¶
type Hover struct {
// contains filtered or unexported fields
}
Hover detects the hover gesture for a pointer area.
func (*Hover) Add ¶
Add the gesture to detect hovering over the current pointer area.
func (*Hover) Hovered ¶
Hovered returns whether a pointer is inside the area.
type Scroll ¶
type Scroll struct {
// contains filtered or unexported fields
}
Scroll detects scroll gestures and reduces them to scroll distances. Scroll recognizes mouse wheel movements as well as drag and fling touch gestures.
func (*Scroll) Add ¶
Add the handler to the operation list to receive scroll events. The bounds variable refers to the scrolling boundaries as defined in io/pointer.InputOp.
func (*Scroll) Scroll ¶
Scroll detects the scrolling distance from the available events and ongoing fling gestures.
func (*Scroll) State ¶
func (s *Scroll) State() ScrollState
State reports the scroll state.
func (*Scroll) Stop ¶
func (s *Scroll) Stop()
Stop any remaining fling movement.
type ScrollState ¶
type ScrollState uint8
const ( // StateIdle is the default scroll state. StateIdle ScrollState = iota // StateDragging is reported during drag gestures. StateDragging // StateFlinging is reported when a fling is // in progress. StateFlinging )
func (ScrollState) String ¶
func (s ScrollState) String() string
Source Files ¶
gesture.go
- Version
- v0.3.1
- Published
- Oct 2, 2023
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 23 minutes ago –
Tools for package owners.