Bug fixes, Framework update, General changes to accommodate new systems.

This commit is contained in:
Tercio Jose
2024-02-26 14:12:11 -03:00
parent 483d9c6976
commit 32adc61608
34 changed files with 1801 additions and 524 deletions
+15 -19
View File
@@ -381,6 +381,8 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
end
end
local noColor = {1, 1, 1, 1}
---add an icon to the left of the button text
---short method truncates the text: false = do nothing, nil = increate the button width, 1 = decrease the font size, 2 = truncate the text
---@param texture any
@@ -403,6 +405,16 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
self.widget.text:SetPoint("left", self.icon, "right", textDistance or 2, 0 + (textHeight or 0))
end
overlay = overlay or noColor
local red, green, blue, alpha = detailsFramework:ParseColors(overlay or noColor)
local left, right, top, bottom = texcoord and texcoord[1], texcoord and texcoord[2], texcoord and texcoord[3], texcoord and texcoord[4]
texture, width, height, left, right, top, bottom, red, green, blue, alpha = detailsFramework:ParseTexture(texture, width, height, left, right, top, bottom, red, green, blue, alpha)
if (red == nil) then
red, green, blue, alpha = 1, 1, 1, 1
end
if (type(texture) == "string") then
local isAtlas = C_Texture.GetAtlasInfo(texture)
if (isAtlas) then
@@ -414,33 +426,17 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin)
else
self.icon:SetTexture(texture)
end
elseif (type(texture) == "table") then
local r, g, b, a = detailsFramework:ParseColors(texture)
self.icon:SetColorTexture(r, g, b, a)
else
self.icon:SetTexture(texture)
end
self.icon:SetSize(width or self.height * 0.8, height or self.height * 0.8)
self.icon:SetDrawLayer(layout or "artwork")
if (texcoord) then
self.icon:SetTexCoord(unpack(texcoord))
else
self.icon:SetTexCoord(0, 1, 0, 1)
end
self.icon:SetTexCoord(left, right, top, bottom)
if (overlay) then
if (type(overlay) == "string") then
local r, g, b, a = detailsFramework:ParseColors(overlay)
self.icon:SetVertexColor(r, g, b, a)
else
self.icon:SetVertexColor(unpack(overlay))
end
else
self.icon:SetVertexColor(1, 1, 1, 1)
end
self.icon:SetVertexColor(red, green, blue, alpha)
local buttonWidth = self.button:GetWidth()
local iconWidth = self.icon:GetWidth()