Fix nested list positioning issues

This commit is contained in:
Kenny Shields 2014-08-16 14:35:26 -04:00
parent 7f8963b3e1
commit a3fb10f0fd
2 changed files with 16 additions and 8 deletions

View File

@ -135,23 +135,23 @@ function newobject:update(dt)
end end
end end
self:CheckHover()
local parent = self.parent local parent = self.parent
local base = loveframes.base local base = loveframes.base
local update = self.Update local update = self.Update
local internals = self.internals local internals = self.internals
for k, v in ipairs(internals) do
v:update(dt)
end
-- move to parent if there is a parent -- move to parent if there is a parent
if parent ~= base then if parent ~= base then
self.x = parent.x + self.staticx self.x = parent.x + self.staticx
self.y = parent.y + self.staticy self.y = parent.y + self.staticy
end end
self:CheckHover()
for k, v in ipairs(internals) do
v:update(dt)
end
if update then if update then
update(self, dt) update(self, dt)
end end

View File

@ -60,6 +60,8 @@ function newobject:update(dt)
end end
end end
self:CheckHover()
local internals = self.internals local internals = self.internals
local children = self.children local children = self.children
local display = self.display local display = self.display
@ -74,10 +76,12 @@ function newobject:update(dt)
self.y = self.parent.y + self.staticy self.y = self.parent.y + self.staticy
end end
self:CheckHover()
for k, v in ipairs(internals) do for k, v in ipairs(internals) do
v:update(dt) v:update(dt)
for _, p in pairs(self:GetParents()) do
v.x = v.x - (p.offsetx or 0)
v.y = v.y - (p.offsety or 0)
end
end end
local x = self.x local x = self.x
@ -92,6 +96,10 @@ function newobject:update(dt)
v:SetClickBounds(x, y, width, height) v:SetClickBounds(x, y, width, height)
v.x = (v.parent.x + v.staticx) - offsetx v.x = (v.parent.x + v.staticx) - offsetx
v.y = (v.parent.y + v.staticy) - offsety v.y = (v.parent.y + v.staticy) - offsety
for _, p in pairs(self:GetParents()) do
v.x = v.x - (p.offsetx or 0)
v.y = v.y - (p.offsety or 0)
end
if display == "vertical" then if display == "vertical" then
if v.lastheight ~= v.height then if v.lastheight ~= v.height then
self:CalculateSize() self:CalculateSize()