zntg/ui/length.go

33 lines
468 B
Go
Raw Normal View History

package ui
import "opslag.de/schobers/geom"
type Length struct {
float32
}
func (l *Length) Value() float32 {
if l == nil {
return 0
}
return l.float32
}
func (l *Length) Zero(value float32) float32 {
if l == nil {
return value
}
return l.Value()
}
func Fixed(l float32) *Length { return &Length{l} }
func Infinite() *Length { return &Length{geom.NaN32()} }
type SideLengths struct {
Left *Length
Top *Length
Right *Length
Bottom *Length
}