Added documentation for the sliders

This commit is contained in:
Sasha Koshka 2023-02-11 17:04:50 -05:00
parent d7a6193c04
commit 7f1c3ae870
2 changed files with 16 additions and 0 deletions

View File

@ -7,12 +7,16 @@ type Numeric interface {
~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
} }
// LerpSlider is a slider that has a minimum and maximum value, and who's value
// can be any numeric type.
type LerpSlider[T Numeric] struct { type LerpSlider[T Numeric] struct {
*Slider *Slider
min T min T
max T max T
} }
// NewLerpSlider creates a new LerpSlider with a minimum and maximum value. If
// vertical is set to true, the slider will be vertical instead of horizontal.
func NewLerpSlider[T Numeric] (min, max T, value T, vertical bool) (element *LerpSlider[T]) { func NewLerpSlider[T Numeric] (min, max T, value T, vertical bool) (element *LerpSlider[T]) {
if min > max { if min > max {
temp := max temp := max