mirror of
https://github.com/linux-man/LoveFrames.git
synced 2024-11-18 16:04:22 +00:00
Add support for relative object sizing
This commit is contained in:
parent
f0349fce02
commit
5b1db7159d
@ -479,36 +479,55 @@ function newobject:CenterWithinArea(x, y, width, height)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetSize(width, height)
|
||||
- func: SetSize(width, height, r1, r2)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetSize(width, height)
|
||||
function newobject:SetSize(width, height, r1, r2)
|
||||
|
||||
self.width = width
|
||||
self.height = height
|
||||
if r1 then
|
||||
self.width = self.parent.width * width
|
||||
else
|
||||
self.width = width
|
||||
end
|
||||
|
||||
if r2 then
|
||||
self.height = self.parent.height * height
|
||||
else
|
||||
self.height = height
|
||||
end
|
||||
|
||||
return self
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetWidth(width)
|
||||
- func: SetWidth(width, relative)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetWidth(width)
|
||||
function newobject:SetWidth(width, relative)
|
||||
|
||||
if relative then
|
||||
self.width = self.parent.width * width
|
||||
else
|
||||
self.width = width
|
||||
end
|
||||
|
||||
self.width = width
|
||||
return self
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetHeight(height)
|
||||
- func: SetHeight(height, relative)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetHeight(height)
|
||||
function newobject:SetHeight(height, relative)
|
||||
|
||||
if relative then
|
||||
self.height = self.parent.height * height
|
||||
else
|
||||
self.height = height
|
||||
end
|
||||
|
||||
self.height = height
|
||||
return self
|
||||
|
||||
end
|
||||
|
@ -291,36 +291,55 @@ function newobject:GetText()
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetSize(width, height)
|
||||
- func: SetSize(width, height, r1, r2)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetSize(width, height)
|
||||
function newobject:SetSize(width, height, r1, r2)
|
||||
|
||||
self.boxwidth = width
|
||||
self.boxheight = height
|
||||
if r1 then
|
||||
self.boxwidth = self.parent.width * width
|
||||
else
|
||||
self.boxwidth = width
|
||||
end
|
||||
|
||||
if r2 then
|
||||
self.boxheight = self.parent.height * height
|
||||
else
|
||||
self.boxheight = height
|
||||
end
|
||||
|
||||
return self
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetWidth(width)
|
||||
- func: SetWidth(width, relative)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetWidth(width)
|
||||
function newobject:SetWidth(width, relative)
|
||||
|
||||
if relative then
|
||||
self.boxwidth = self.parent.width * width
|
||||
else
|
||||
self.boxwidth = width
|
||||
end
|
||||
|
||||
self.boxwidth = width
|
||||
return self
|
||||
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetHeight(height)
|
||||
- func: SetHeight(height, relative)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetHeight(height)
|
||||
function newobject:SetHeight(height, relative)
|
||||
|
||||
if relative then
|
||||
self.boxheight = self.parent.height * height
|
||||
else
|
||||
self.boxheight = height
|
||||
end
|
||||
|
||||
self.boxheight = height
|
||||
return self
|
||||
|
||||
end
|
||||
|
@ -273,12 +273,17 @@ function newobject:GetObject()
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetSize(width, height)
|
||||
- func: SetSize(width, height, relative)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetSize(width, height)
|
||||
function newobject:SetSize(width, height, relative)
|
||||
|
||||
if relative then
|
||||
self.width = self.parent.width * width
|
||||
else
|
||||
self.width = width
|
||||
end
|
||||
|
||||
self.width = width
|
||||
return self
|
||||
|
||||
end
|
||||
|
@ -296,16 +296,26 @@ function newobject:GetColumnSize()
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetSize(width, height)
|
||||
- func: SetSize(width, height, r1, r2)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetSize(width, height)
|
||||
function newobject:SetSize(width, height, r1, r2)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
|
||||
self.width = width
|
||||
self.height = height
|
||||
if r1 then
|
||||
self.width = self.parent.width * width
|
||||
else
|
||||
self.width = width
|
||||
end
|
||||
|
||||
if r2 then
|
||||
self.height = self.parent.height * height
|
||||
else
|
||||
self.height = height
|
||||
end
|
||||
|
||||
self:AdjustColumns()
|
||||
|
||||
list:SetSize(width, height)
|
||||
@ -318,15 +328,20 @@ function newobject:SetSize(width, height)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetWidth(width)
|
||||
- func: SetWidth(width, relative)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetWidth(width)
|
||||
function newobject:SetWidth(width, relative)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
|
||||
self.width = width
|
||||
if relative then
|
||||
self.width = self.parent.width * width
|
||||
else
|
||||
self.width = width
|
||||
end
|
||||
|
||||
self:AdjustColumns()
|
||||
|
||||
list:SetSize(width)
|
||||
@ -339,15 +354,20 @@ function newobject:SetWidth(width)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetHeight(height)
|
||||
- func: SetHeight(height, relative)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetHeight(height)
|
||||
function newobject:SetHeight(height, relative)
|
||||
|
||||
local internals = self.internals
|
||||
local list = internals[1]
|
||||
|
||||
self.height = height
|
||||
if relative then
|
||||
self.height = self.parent.height * height
|
||||
else
|
||||
self.height = height
|
||||
end
|
||||
|
||||
self:AdjustColumns()
|
||||
|
||||
list:SetSize(height)
|
||||
|
@ -589,12 +589,17 @@ function newobject:Clear()
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetWidth(width)
|
||||
- func: SetWidth(width, relative)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetWidth(width)
|
||||
function newobject:SetWidth(width, relative)
|
||||
|
||||
if relative then
|
||||
self.width = self.parent.width * width
|
||||
else
|
||||
self.width = width
|
||||
end
|
||||
|
||||
self.width = width
|
||||
self:CalculateSize()
|
||||
self:RedoLayout()
|
||||
|
||||
@ -603,12 +608,17 @@ function newobject:SetWidth(width)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetHeight(height)
|
||||
- func: SetHeight(height, relative)
|
||||
- desc: sets the object's height
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetHeight(height)
|
||||
function newobject:SetHeight(height, relative)
|
||||
|
||||
if relative then
|
||||
self.height = self.parent.height * height
|
||||
else
|
||||
self.height = height
|
||||
end
|
||||
|
||||
self.height = height
|
||||
self:CalculateSize()
|
||||
self:RedoLayout()
|
||||
|
||||
@ -617,13 +627,23 @@ function newobject:SetHeight(height)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: GetSize()
|
||||
- desc: gets the object's size
|
||||
- func: SetSize(width, height, r1, r2)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetSize(width, height)
|
||||
function newobject:SetSize(width, height, r1, r2)
|
||||
|
||||
if r1 then
|
||||
self.width = self.parent.width * width
|
||||
else
|
||||
self.width = width
|
||||
end
|
||||
|
||||
if r2 then
|
||||
self.height = self.parent.height * height
|
||||
else
|
||||
self.height = height
|
||||
end
|
||||
|
||||
self.width = width
|
||||
self.height = height
|
||||
self:CalculateSize()
|
||||
self:RedoLayout()
|
||||
|
||||
|
@ -590,12 +590,17 @@ function newobject:GetMaxWidth()
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetWidth(width)
|
||||
- func: SetWidth(width, relative)
|
||||
- desc: sets the object's width
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetWidth(width)
|
||||
function newobject:SetWidth(width, relative)
|
||||
|
||||
if relative then
|
||||
self:SetMaxWidth(self.parent.width * width)
|
||||
else
|
||||
self:SetMaxWidth(width)
|
||||
end
|
||||
|
||||
self:SetMaxWidth(width)
|
||||
return self
|
||||
|
||||
end
|
||||
@ -611,12 +616,17 @@ function newobject:SetHeight(height)
|
||||
end
|
||||
|
||||
--[[---------------------------------------------------------
|
||||
- func: SetSize()
|
||||
- func: SetSize(width, height, relative)
|
||||
- desc: sets the object's size
|
||||
--]]---------------------------------------------------------
|
||||
function newobject:SetSize(width, height)
|
||||
function newobject:SetSize(width, height, relative)
|
||||
|
||||
if relative then
|
||||
self:SetMaxWidth(self.parent.width * width)
|
||||
else
|
||||
self:SetMaxWidth(width)
|
||||
end
|
||||
|
||||
self:SetMaxWidth(width)
|
||||
return self
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user