mobile: Index | Files

package touch

import ""

Package touch defines an event for touch input.

See the package for details on the event model.


Package Files


type Event Uses

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 Uses

type Sequence int64

Sequence identifies a sequence of touch events.

type Type Uses

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.

    // 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.

func (Type) String Uses

func (t Type) String() string

Package touch imports 1 packages (graph) and is imported by 69 packages. Updated 2020-08-03. Refresh now. Tools for package owners.