Skip to content

Commit

Permalink
Fix auto-sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf81 committed Apr 16, 2024
1 parent 160a977 commit 995744a
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions composer/layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,15 @@ local HStack = {}
HStack.__index = HStack

function HStack:new(...)
local this = Layout.new(self, ...)
local args = { ... }

local stretch = F.removeMatch(args, function(v)
return getmetatable(v) == Stretch
end)

stretch = stretch or Stretch(1, 0)

local this = Layout.new(self, stretch, ...)

return setmetatable(this, HStack)
end
Expand Down Expand Up @@ -244,7 +252,15 @@ local VStack = {}
VStack.__index = VStack

function VStack:new(...)
local this = Layout.new(self, ...)
local args = { ... }

local stretch = F.removeMatch(args, function(v)
return getmetatable(v) == Stretch
end)

stretch = stretch or Stretch(0, 1)

local this = Layout.new(self, stretch, ...)

return setmetatable(this, VStack)
end
Expand Down

0 comments on commit 995744a

Please sign in to comment.