zntg/ui/length.go
Sander Schobers eb0e8322ef Changed Length.Zero to return value instead of Length.
Spacing shorthand methods now returns Spacing object instead of Control interface.
2019-04-11 08:44:38 +02:00

33 lines
468 B
Go

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
}