Skip to content

Commit

Permalink
Remove fundamentally broken container minsize cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Mar 10, 2024
1 parent 27c9f22 commit e673db4
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ var _ CanvasObject = (*Container)(nil)
type Container struct {
size Size // The current size of the Container
position Position // The current position of the Container
minCache Size
Hidden bool // Is this Container hidden
Hidden bool // Is this Container hidden

Layout Layout // The Layout algorithm for arranging child CanvasObjects
lock sync.Mutex
Expand Down Expand Up @@ -87,10 +86,6 @@ func (c *Container) Hide() {
// MinSize calculates the minimum size of a Container.
// This is delegated to the Layout, if specified, otherwise it will mimic MaxLayout.
func (c *Container) MinSize() Size {
if !c.minCache.IsZero() {
return c.minCache
}

if c.Layout != nil {
return c.Layout.MinSize(c.Objects)
}
Expand All @@ -100,7 +95,6 @@ func (c *Container) MinSize() Size {
minSize = minSize.Max(child.MinSize())
}

c.minCache = minSize
return minSize
}

Expand All @@ -117,8 +111,6 @@ func (c *Container) Position() Position {

// Refresh causes this object to be redrawn in it's current state
func (c *Container) Refresh() {
c.minCache = Size{}

c.layout()

for _, child := range c.Objects {
Expand Down

0 comments on commit e673db4

Please sign in to comment.