scroll

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Axis

type Axis uint8
const (
	Horizontal Axis = iota
	Vertical
)

func (Axis) String

func (a Axis) String() string

type Hover

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

Hover is a gesture to detect if a pointer keeps still for some time over the area.

func (*Hover) Add

func (h *Hover) Add(ops *op.Ops)

Add the gesture to detect hovering over the current pointer area.

func (*Hover) Hovering

func (h *Hover) Hovering() bool

func (*Hover) Update

func (h *Hover) Update(gtx layout.Context) (HoverEvent, bool)

Update state and report whether a pointer is hovering over the area. The return value indicates if the hover state just started or canceled in this update cycle. Use Hovering() for the continuous state.

type HoverEvent

type HoverEvent struct {
	Kind     HoverKind
	Position image.Point
}

type HoverKind

type HoverKind uint8
const (
	KindHovered HoverKind = iota + 1
	KindCancelled
)

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.

This is a modified version of the original [gesture.Scroll] in Gio. The most important change is that scrolling axis is detected, not passed by user.

func (*Scroll) Add

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

Add the handler to the operation list to receive scroll events. The bounds variable refers to the scrolling boundaries as defined in pointer.Filter.

func (*Scroll) Direction

func (s *Scroll) Direction() Axis

Direction returns the last scrolling axis detected by Update.

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.

func (*Scroll) Update

func (s *Scroll) Update(cfg unit.Metric, q input.Source, t time.Time, scrollx, scrolly pointer.ScrollRange) int

Update state and report the scroll distance along axis.

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

Directories

Path Synopsis
This package is copied from Gio internal fling package: https://github.com/gioui/gio/tree/main/internal/fling.
This package is copied from Gio internal fling package: https://github.com/gioui/gio/tree/main/internal/fling.

Jump to

Keyboard shortcuts

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