Merge pull request #119 from qaisjp/patch-2

Fixed Frame:MakeTop() chaining issue
This commit is contained in:
Kenny Shields 2014-04-20 18:06:01 -04:00
commit 3c09e85d2b

View File

@ -762,30 +762,27 @@ end
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:MakeTop() function newobject:MakeTop()
local x, y = love.mouse.getPosition()
local key = 0 local key = 0
local base = loveframes.base
local basechildren = base.children local basechildren = base.children
local numbasechildren = #basechildren local numbasechildren = #basechildren
local parent = self.parent
-- check to see if the object's parent is not the base object -- check to see if the object's parent is not the base object
if parent ~= base then if self.parent ~= loveframes.base then
local baseparent = self:GetBaseParent() local baseparent = self:GetBaseParent()
if baseparent.type == "frame" then if baseparent.type == "frame" then
baseparent:MakeTop() baseparent:MakeTop()
end end
return return self
end end
-- check to see if the object is the only child of the base object -- check to see if the object is the only child of the base object
if numbasechildren == 1 then if numbasechildren == 1 then
return return self
end end
-- check to see if the object is already at the top -- check to see if the object is already at the top
if basechildren[numbasechildren] == self then if basechildren[numbasechildren] == self then
return return self
end end
-- make this the top object -- make this the top object