zntg/ui/length.go
Sander Schobers 3ea0d76efb Created unified spacing control.
Build control methods now accept nil as visitor method.
2019-03-12 21:11:43 +01:00

33 lines
469 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) *Length {
if l == nil {
return &Length{value}
}
return l
}
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
}