gioui.org: gioui.org/gesture Index | Files

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

Package Files

gesture.go

type Axis Uses

type Axis uint8
const (
    Horizontal Axis = iota
    Vertical
)

func (Axis) String Uses

func (a Axis) String() string

type Click Uses

type Click struct {
    // contains filtered or unexported fields
}

Click detects click gestures in the form of ClickEvents.

func (*Click) Add Uses

func (c *Click) Add(ops *op.Ops)

Add the handler to the operation list to receive click events.

func (*Click) Events Uses

func (c *Click) Events(q event.Queue) []ClickEvent

Events returns the next click event, if any.

func (*Click) State Uses

func (c *Click) State() ClickState

State reports the click state.

type ClickEvent Uses

type ClickEvent struct {
    Type      ClickType
    Position  f32.Point
    Source    pointer.Source
    Modifiers key.Modifiers
}

ClickEvent represent a click action, either a TypePress for the beginning of a click or a TypeClick for a completed click.

type ClickState Uses

type ClickState uint8
const (
    // StateNormal is the default click state.
    StateNormal ClickState = iota
    // StateFocused is reported when a pointer
    // is hovering over the handler.
    StateFocused
    // StatePressed is then a pointer is pressed.
    StatePressed
)

func (ClickState) String Uses

func (cs ClickState) String() string

type ClickType Uses

type ClickType uint8
const (
    // TypePress is reported for the first pointer
    // press.
    TypePress ClickType = iota
    // TypeClick is reporoted when a click action
    // is complete.
    TypeClick
)

func (ClickType) String Uses

func (ct ClickType) String() string

type Scroll Uses

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 Uses

func (s *Scroll) Add(ops *op.Ops)

Add the handler to the operation list to receive scroll events.

func (*Scroll) Scroll Uses

func (s *Scroll) Scroll(cfg unit.Converter, q event.Queue, t time.Time, axis Axis) int

Scroll detects the scrolling distance from the available events and ongoing fling gestures.

func (*Scroll) State Uses

func (s *Scroll) State() ScrollState

State reports the scroll state.

func (*Scroll) Stop Uses

func (s *Scroll) Stop()

Stop any remaining fling movement.

type ScrollState Uses

type ScrollState uint8
const (
    // StateIdle is the default scroll state.
    StateIdle ScrollState = iota
    // StateDrag is reported during drag gestures.
    StateDragging
    // StateFlinging is reported when a fling is
    // in progress.
    StateFlinging
)

func (ScrollState) String Uses

func (s ScrollState) String() string

Package gesture imports 9 packages (graph) and is imported by 5 packages. Updated 2019-11-19. Refresh now. Tools for package owners.