类型 Carousel

API 文档由 Go 源码生成,内容为英文。

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

Carousel is a clipped viewport with caller-owned offset, selected index, item count, and content extent. Keyboard routing, dragging, pointer capture, inertia, autoplay, observers, timers, and virtualization are runtime or application responsibilities and are intentionally absent from this recipe.

构造函数

BeginCarousel#

func BeginCarousel(canvas *ui.Canvas, theme ui.Theme, bounds ui.Rect, itemCount, index int) Carousel

BeginCarousel declares carousel state without retaining item data.

方法

BeginContent#

func (carousel *Carousel) BeginContent() CarouselGeometry

BeginContent pushes the viewport clip for caller-painted slides.

Content#

func (carousel Carousel) Content(extent, offset float32) Carousel

Content sets the caller-owned total axis extent and current scroll offset.

Controls#

func (carousel Carousel) Controls(previousID ui.ID, previousLabel string, nextID ui.ID, nextLabel string) Carousel

Controls assigns stable previous and next action IDs and accessible labels.

Disabled#

func (carousel Carousel) Disabled() Carousel

Disabled keeps both control bounds and semantics while making them inert.

EndContent#

func (carousel *Carousel) EndContent() CarouselGeometry

EndContent closes the clip and paints both stable navigation controls.

Geometry#

func (carousel Carousel) Geometry() CarouselGeometry

Geometry returns clamped content and stable external control bounds.

ItemGeometry#

func (carousel Carousel) ItemGeometry(index int, contentOffset, extent float32) CarouselItemGeometry

ItemGeometry translates one caller-supplied slide offset and extent along the carousel axis. It does not retain, measure, or virtualize the item.

Label#

func (carousel Carousel) Label(label string) Carousel

Label names the carousel region for assistive technology.

Vertical#

func (carousel Carousel) Vertical() Carousel

Vertical changes the content axis and control placement to vertical.