From 12a9f5ee393aa453f0b87f8eb71837a2b1dc825f Mon Sep 17 00:00:00 2001 From: Sander Schobers <sander@schobers.eu> Date: Mon, 19 Jul 2021 17:55:43 +0200 Subject: [PATCH] Last visibile item in StackPanel is now clipped to maximum available area. --- ui/stackpanel.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/stackpanel.go b/ui/stackpanel.go index 6ae42a9..74c5819 100644 --- a/ui/stackpanel.go +++ b/ui/stackpanel.go @@ -42,7 +42,9 @@ func (p *StackPanel) Arrange(ctx Context, bounds geom.RectangleF32, offset geom. height = remainder / float32(stretch) } } - var child = geom.RectF32(bounds.Min.X, bounds.Min.Y+childOffset, bounds.Max.X, bounds.Min.Y+childOffset+height) + minY := geom.Min32(bounds.Max.Y, bounds.Min.Y+childOffset) + maxY := geom.Min32(bounds.Max.Y, bounds.Min.Y+childOffset+height) + var child = geom.RectF32(bounds.Min.X, minY, bounds.Max.X, maxY) p.Children[i].Arrange(ctx, p.Orientation.FlipRect(child), offset, p) childOffset += height }