fixed autosize on bigfonts
This commit is contained in:
@@ -1802,7 +1802,7 @@ local function Label(name)
|
|||||||
base.fgColor = colors.white
|
base.fgColor = colors.white
|
||||||
base.bgcolor = colors.black
|
base.bgcolor = colors.black
|
||||||
|
|
||||||
local autoWidth = true
|
local autoSize = true
|
||||||
base:setValue("")
|
base:setValue("")
|
||||||
|
|
||||||
local textHorizontalAlign = "left"
|
local textHorizontalAlign = "left"
|
||||||
@@ -1816,7 +1816,7 @@ local function Label(name)
|
|||||||
setText = function(self, text)
|
setText = function(self, text)
|
||||||
text = tostring(text)
|
text = tostring(text)
|
||||||
base:setValue(text)
|
base:setValue(text)
|
||||||
if (autoWidth) then
|
if (autoSize) then
|
||||||
self.width = text:len()
|
self.width = text:len()
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
@@ -1842,7 +1842,7 @@ local function Label(name)
|
|||||||
|
|
||||||
setSize = function(self, width, height)
|
setSize = function(self, width, height)
|
||||||
base.setSize(self, width, height)
|
base.setSize(self, width, height)
|
||||||
autoWidth = false
|
autoSize = false
|
||||||
self:setVisualChanged()
|
self:setVisualChanged()
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
@@ -1863,6 +1863,10 @@ local function Label(name)
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
local tData = makeText(fontsize, self:getValue(), self.fgColor, self.bgColor)
|
local tData = makeText(fontsize, self:getValue(), self.fgColor, self.bgColor)
|
||||||
|
if(autoSize)then
|
||||||
|
self.height = #tData[1]-1
|
||||||
|
self.width = #tData[1][1]
|
||||||
|
end
|
||||||
for n = 1, self.height do
|
for n = 1, self.height do
|
||||||
if (n == verticalAlign) then
|
if (n == verticalAlign) then
|
||||||
local oX, oY = self.parent:getSize()
|
local oX, oY = self.parent:getSize()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user