SetValue sets the position of the button of the scrollbar from 0.0 (minimum) to 1.0 (maximum).
(v float32)
| 136 | // SetValue sets the position of the button of the scrollbar |
| 137 | // from 0.0 (minimum) to 1.0 (maximum). |
| 138 | func (sb *ScrollBar) SetValue(v float32) { |
| 139 | |
| 140 | v = math32.Clamp(v, 0.0, 1.0) |
| 141 | if sb.vertical { |
| 142 | pos := v * (float32(sb.content.Height) - float32(sb.button.height)) |
| 143 | sb.button.SetPositionY(pos) |
| 144 | } else { |
| 145 | pos := v * (float32(sb.content.Width) - float32(sb.button.width)) |
| 146 | sb.button.SetPositionX(pos) |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | // onMouse receives subscribed mouse events over the scrollbar outer panel |
| 151 | func (sb *ScrollBar) onMouse(evname string, ev interface{}) { |
nothing calls this directly
no test coverage detected