mouse

package
v0.0.0-...-b867f16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package mouse defines an event for mouse input.

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button int32

Button is a mouse button.

const (
	ButtonNone   Button = +0
	ButtonLeft   Button = +1
	ButtonMiddle Button = +2
	ButtonRight  Button = +3

	ButtonWheelUp    Button = -1
	ButtonWheelDown  Button = -2
	ButtonWheelLeft  Button = -3
	ButtonWheelRight Button = -4
)

func (Button) IsWheel

func (b Button) IsWheel() bool

IsWheel reports whether the button is for a scroll wheel.

type Direction

type Direction uint8

Direction is the direction of the mouse event.

const (
	DirNone    Direction = 0
	DirPress   Direction = 1
	DirRelease Direction = 2
	// DirStep is a simultaneous press and release, such as a single step of a
	// mouse wheel.
	//
	// Its value equals DirPress | DirRelease.
	DirStep Direction = 3
)

func (Direction) String

func (d Direction) String() string

type Event

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

	// Button is the mouse button being pressed or released. Its value may be
	// zero, for a mouse move or drag without any button change.
	Button Button

	// Modifiers is a bitmask representing a set of modifier keys:
	// key.ModShift, key.ModAlt, etc.
	Modifiers key.Modifiers

	// Direction is the direction of the mouse event: DirPress, DirRelease,
	// or DirNone (for mouse moves or drags).
	Direction Direction
}

Event is a mouse event.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL