Infinite margins should not be taken into account for DesiredSize.
This commit is contained in:
parent
70d9e23b0c
commit
15f02d4d0e
@ -84,9 +84,16 @@ func (s *Spacing) Center() {
|
||||
func (s *Spacing) DesiredSize(ctx Context) geom.PointF32 {
|
||||
var size = s.Proxy.DesiredSize(ctx)
|
||||
var w, h = s.Width.Zero(size.X), s.Height.Zero(size.Y)
|
||||
var margin = func(l *Length) float32 {
|
||||
var v = l.Value()
|
||||
if geom.IsNaN32(v) {
|
||||
return 0
|
||||
}
|
||||
return v
|
||||
}
|
||||
return geom.PtF32(
|
||||
s.Margin.Left.Value()+w+s.Margin.Right.Value(),
|
||||
s.Margin.Top.Value()+h+s.Margin.Bottom.Value())
|
||||
margin(s.Margin.Left)+w+margin(s.Margin.Right),
|
||||
margin(s.Margin.Top)+h+margin(s.Margin.Bottom))
|
||||
}
|
||||
|
||||
func (s *Spacing) SetSize(w, h float32) {
|
||||
|
Loading…
Reference in New Issue
Block a user