Sander Schobers
eb0e8322ef
Spacing shorthand methods now returns Spacing object instead of Control interface.
33 lines
468 B
Go
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
|
|
}
|