33 lines
469 B
Go
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
|
||
|
}
|