Mercurial > wow > hansgar_and_franzok_assist
diff Libs/DF/label.lua @ 22:dbd417f413a8
- framework update.
| author | Tercio |
|---|---|
| date | Tue, 08 Sep 2015 13:16:49 -0300 |
| parents | dc1c77254f80 |
| children | 5da06cb420d4 |
line wrap: on
line diff
--- a/Libs/DF/label.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/label.lua Tue Sep 08 13:16:49 2015 -0300 @@ -219,6 +219,23 @@ end ------------------------------------------------------------------------------------------------------------ + + function LabelMetaFunctions:SetTemplate (template) + if (template.size) then + DF:SetFontSize (self.label, template.size) + end + if (template.color) then + local r, g, b, a = DF:ParseColors (template.color) + self:SetTextColor (r, g, b, a) + end + if (template.font) then + local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") + local font = SharedMedia:Fetch ("font", template.font) + DF:SetFontFace (self.label, font) + end + end + +------------------------------------------------------------------------------------------------------------ --> object constructor function DF:CreateLabel (parent, text, size, color, font, member, name, layer) return DF:NewLabel (parent, nil, name, member, text, font, size, color, layer) @@ -287,22 +304,6 @@ if (size and type (size) == "number") then DF:SetFontSize (LabelObject.label, size) - - elseif (size and type (size) == "table") then - local template = size - - if (template.size) then - DF:SetFontSize (LabelObject.label, template.size) - end - if (template.color) then - local r, g, b, a = DF:ParseColors (template.color) - LabelObject.label:SetTextColor (r, g, b, a) - end - if (template.font) then - local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") - local font = SharedMedia:Fetch ("font", template.font) - DF:SetFontFace (LabelObject.label, font) - end end @@ -310,6 +311,10 @@ LabelObject.label:SetJustifyH ("LEFT") setmetatable (LabelObject, LabelMetaFunctions) + + if (size and type (size) == "table") then + LabelObject:SetTemplate (size) + end return LabelObject end \ No newline at end of file
