mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Grid CalculateSize() fix #21
This commit is contained in:
parent
bb5a21b39b
commit
09f1b941ca
@ -412,6 +412,7 @@ function newobject:Center()
|
|||||||
local base = loveframes.base
|
local base = loveframes.base
|
||||||
local parent = self.parent
|
local parent = self.parent
|
||||||
|
|
||||||
|
if self.CalculateSize then self:CalculateSize() end
|
||||||
if parent == base then
|
if parent == base then
|
||||||
local width = love.graphics.getWidth()
|
local width = love.graphics.getWidth()
|
||||||
local height = love.graphics.getHeight()
|
local height = love.graphics.getHeight()
|
||||||
|
@ -70,8 +70,7 @@ function newobject:update(dt)
|
|||||||
local prevwidth = self.prevwidth
|
local prevwidth = self.prevwidth
|
||||||
local prevheight = self.prevheight
|
local prevheight = self.prevheight
|
||||||
|
|
||||||
self.width = (self.columns * self.cellwidth) + (self.columns * (self.cellpadding * 2))
|
self:CalculateSize()
|
||||||
self.height = (self.rows * self.cellheight) + (self.rows * (self.cellpadding * 2))
|
|
||||||
|
|
||||||
if self.width ~= prevwidth or self.height ~= prevheight then
|
if self.width ~= prevwidth or self.height ~= prevheight then
|
||||||
local onsizechanged = self.OnSizeChanged
|
local onsizechanged = self.OnSizeChanged
|
||||||
@ -92,6 +91,15 @@ function newobject:update(dt)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[---------------------------------------------------------
|
||||||
|
- func: CalculateSize()
|
||||||
|
- desc: calculate the object size
|
||||||
|
--]]---------------------------------------------------------
|
||||||
|
function newobject:CalculateSize()
|
||||||
|
self.width = (self.columns * self.cellwidth) + (self.columns * (self.cellpadding * 2))
|
||||||
|
self.height = (self.rows * self.cellheight) + (self.rows * (self.cellpadding * 2))
|
||||||
|
end
|
||||||
|
|
||||||
function newobject:_update_children_position()
|
function newobject:_update_children_position()
|
||||||
for k, v in ipairs(self.children) do
|
for k, v in ipairs(self.children) do
|
||||||
local rs, cs = self:GetCellSpanSize(v.gridrow, v.gridcolumn)
|
local rs, cs = self:GetCellSpanSize(v.gridrow, v.gridcolumn)
|
||||||
|
Loading…
Reference in New Issue
Block a user