mobile: golang.org/x/mobile/event/touch Index | Files

package touch

import "golang.org/x/mobile/event/touch"

Package touch defines an event for touch input.

See the golang.org/x/mobile/app package for details on the event model.

Index

Package Files

touch.go

type Event

type Event struct {
    // X and Y are the touch location, in pixels.
    X, Y float32

    // Sequence is the sequence number. The same number is shared by all events
    // in a sequence. A sequence begins with a single TypeBegin, is followed by
    // zero or more TypeMoves, and ends with a single TypeEnd. A Sequence
    // distinguishes concurrent sequences but its value is subsequently reused.
    Sequence Sequence

    // Type is the touch type.
    Type Type
}

Event is a touch event.

type Sequence

type Sequence int64

Sequence identifies a sequence of touch events.

type Type

type Type byte

Type describes the type of a touch event.

const (
    // TypeBegin is a user first touching the device.
    //
    // On Android, this is a AMOTION_EVENT_ACTION_DOWN.
    // On iOS, this is a call to touchesBegan.
    TypeBegin Type = iota

    // TypeMove is a user dragging across the device.
    //
    // A TypeMove is delivered between a TypeBegin and TypeEnd.
    //
    // On Android, this is a AMOTION_EVENT_ACTION_MOVE.
    // On iOS, this is a call to touchesMoved.
    TypeMove

    // TypeEnd is a user no longer touching the device.
    //
    // On Android, this is a AMOTION_EVENT_ACTION_UP.
    // On iOS, this is a call to touchesEnded.
    TypeEnd
)

func (Type) String

func (t Type) String() string

Package touch imports 1 packages (graph) and is imported by 15 packages. Updated 6 days ago. Refresh now. Tools for package owners.