Position scrollbuttons immediately after their creation

This commit is contained in:
Kenny Shields 2014-01-24 22:17:48 -05:00
parent b8648541a6
commit cb59b59a73

View File

@ -38,6 +38,8 @@ function newobject:initialize(parent, bartype)
if self.bartype == "vertical" then if self.bartype == "vertical" then
local upbutton = loveframes.objects["scrollbutton"]:new("up") local upbutton = loveframes.objects["scrollbutton"]:new("up")
upbutton.staticx = 0 + self.width - upbutton.width
upbutton.staticy = 0
upbutton.parent = self upbutton.parent = self
upbutton.Update = function(object, dt) upbutton.Update = function(object, dt)
upbutton.staticx = 0 + self.width - upbutton.width upbutton.staticx = 0 + self.width - upbutton.width
@ -54,6 +56,8 @@ function newobject:initialize(parent, bartype)
end end
local downbutton = loveframes.objects["scrollbutton"]:new("down") local downbutton = loveframes.objects["scrollbutton"]:new("down")
downbutton.parent = self downbutton.parent = self
downbutton.staticx = 0 + self.width - downbutton.width
downbutton.staticy = 0 + self.height - downbutton.height
downbutton.Update = function(object, dt) downbutton.Update = function(object, dt)
downbutton.staticx = 0 + self.width - downbutton.width downbutton.staticx = 0 + self.width - downbutton.width
downbutton.staticy = 0 + self.height - downbutton.height downbutton.staticy = 0 + self.height - downbutton.height
@ -72,6 +76,8 @@ function newobject:initialize(parent, bartype)
elseif self.bartype == "horizontal" then elseif self.bartype == "horizontal" then
local leftbutton = loveframes.objects["scrollbutton"]:new("left") local leftbutton = loveframes.objects["scrollbutton"]:new("left")
leftbutton.parent = self leftbutton.parent = self
leftbutton.staticx = 0
leftbutton.staticy = 0
leftbutton.Update = function(object, dt) leftbutton.Update = function(object, dt)
leftbutton.staticx = 0 leftbutton.staticx = 0
leftbutton.staticy = 0 leftbutton.staticy = 0
@ -87,6 +93,8 @@ function newobject:initialize(parent, bartype)
end end
local rightbutton = loveframes.objects["scrollbutton"]:new("right") local rightbutton = loveframes.objects["scrollbutton"]:new("right")
rightbutton.parent = self rightbutton.parent = self
rightbutton.staticx = 0 + self.width - rightbutton.width
rightbutton.staticy = 0
rightbutton.Update = function(object, dt) rightbutton.Update = function(object, dt)
rightbutton.staticx = 0 + self.width - rightbutton.width rightbutton.staticx = 0 + self.width - rightbutton.width
rightbutton.staticy = 0 rightbutton.staticy = 0