类型 ScrollAreaGeometry

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

type ScrollAreaGeometry struct {
	Bounds          ui.Rect
	Viewport        ui.Rect
	Content         ui.Rect
	VerticalTrack   ui.Rect
	VerticalThumb   ui.Rect
	HorizontalTrack ui.Rect
	HorizontalThumb ui.Rect
	Corner          ui.Rect
	OffsetX         float32
	OffsetY         float32
	MaxOffsetX      float32
	MaxOffsetY      float32
}

ScrollAreaGeometry is the complete deterministic layout of one externally controlled scroll area. Content is already translated by the clamped offset.

方法

VerticalOffsetForThumb#

func (geometry ScrollAreaGeometry) VerticalOffsetForThumb(thumbTop float32) float32

VerticalOffsetForThumb returns the content offset that places the top edge of the vertical thumb at thumbTop: the inverse of the thumb placement, clamped to [0, MaxOffsetY]. A caller turns a pointer drag on the scrollbar into its owned offset with it, without repeating the track insets. It is zero when the area does not scroll vertically.