Fixed bugs in Overflow control.

- Tries to take as much space as possible.
- Draw buffer should be exactly size needed.
This commit is contained in:
Sander Schobers 2019-03-12 20:08:47 +01:00
parent f31cd28771
commit d14a9bd0e7

View File

@ -86,6 +86,10 @@ func (o *overflow) Arrange(ctx Context, bounds geom.RectangleF32, offset geom.Po
}
}
func (o *overflow) DesiredSize(ctx Context) geom.PointF32 {
return geom.PtF32(geom.NaN32(), geom.NaN32())
}
func (o *overflow) Handle(ctx Context, e Event) {
hor, ver := o.shouldScroll(o.bounds)
if hor {
@ -119,6 +123,7 @@ func (o *overflow) Render(ctx Context) {
}
var content = o.Content.Bounds()
content.Min = geom.ZeroPtF32
if o.buffer == nil || o.buffer.Width() != content.Dx() || o.buffer.Height() != content.Dy() {
if o.buffer != nil {
o.buffer.Destroy()