fix uninitialized variables in container layout
variables `x` and `y` shadowed the parameters, and `containerX`, `containerY`, `containerWidth` and `containerHeight` were used without being initialized. they could be replaced by the parameters `width` and `height`
This commit is contained in:
parent
cac01a34c9
commit
fc2d5c862a
@ -53,20 +53,19 @@ end
|
||||
|
||||
function container:draw(x, y, width, height, children, hpad, vpad, alignX)
|
||||
local w, h = children[1]:getSize()
|
||||
local x, y
|
||||
|
||||
if self.halign == 'stretch' then
|
||||
w = width
|
||||
x = x
|
||||
else
|
||||
x = alignHandlerX(self.halign, containerX, containerWidth, w)
|
||||
x = alignHandlerX(self.halign, x, width, w)
|
||||
end
|
||||
|
||||
if self.valign == 'stretch' then
|
||||
h = h
|
||||
h = height
|
||||
y = y
|
||||
else
|
||||
y = alignHandlerY(self.valign, containerY, containerHeight, h)
|
||||
y = alignHandlerY(self.valign, y, height, h)
|
||||
end
|
||||
|
||||
children[1]:draw(x, y, w, h)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user