MCPcopy
hub / github.com/g3n/engine / Value

Method Value

gui/scrollbar.go:118–134  ·  view source on GitHub ↗

Value returns the current position of the button in the scrollbar The returned value is between 0.0 and 1.0

()

Source from the content-addressed store, hash-verified

116// Value returns the current position of the button in the scrollbar
117// The returned value is between 0.0 and 1.0
118func (sb *ScrollBar) Value() float64 {
119
120 if sb.vertical {
121 den := float64(sb.content.Height) - float64(sb.button.height)
122 if den == 0 {
123 return 0
124 }
125 return float64(sb.button.Position().Y) / den
126 }
127
128 // horizontal
129 den := float64(sb.content.Width) - float64(sb.button.width)
130 if den == 0 {
131 return 0
132 }
133 return float64(sb.button.Position().X) / den
134}
135
136// SetValue sets the position of the button of the scrollbar
137// from 0.0 (minimum) to 1.0 (maximum).

Callers

nothing calls this directly

Calls 1

PositionMethod · 0.65

Tested by

no test coverage detected