from retail
This commit is contained in:
+227
-181
@@ -53,6 +53,11 @@ local properties = {
|
||||
setter = "Color",
|
||||
type = "color",
|
||||
},
|
||||
icon_visible = {
|
||||
display = L["Icon Visible"],
|
||||
setter = "SetIconVisible",
|
||||
type = "bool"
|
||||
},
|
||||
icon_color = {
|
||||
display = L["Icon Color"],
|
||||
setter = "SetIconColor",
|
||||
@@ -552,6 +557,151 @@ local barPrototype = {
|
||||
["orientation"] = "HORIZONTAL",
|
||||
}
|
||||
|
||||
local GetRealSize = {
|
||||
["HORIZONTAL"] = {
|
||||
[true] = function(self)
|
||||
return self.totalWidth - self.iconWidth, self.totalHeight
|
||||
end,
|
||||
[false] = function(self)
|
||||
return self.totalWidth, self.totalHeight
|
||||
end
|
||||
},
|
||||
["VERTICAL"] = {
|
||||
[true] = function(self)
|
||||
return self.totalWidth, self.totalHeight - self.iconHeight
|
||||
end,
|
||||
[false] = function(self)
|
||||
return self.totalWidth, self.totalHeight
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
-- Orientation helper methods
|
||||
local function orientHorizontalInverse(region)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
bar.GetRealSize = GetRealSize["HORIZONTAL"][region.iconVisible or false]
|
||||
|
||||
-- Align icon and bar
|
||||
if region.iconVisible then
|
||||
if region.icon_side == "LEFT" then
|
||||
icon:SetPoint("LEFT", region, "LEFT");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "TOPRIGHT");
|
||||
else
|
||||
icon:SetPoint("RIGHT", region, "RIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT");
|
||||
bar:SetPoint("TOPRIGHT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation(region.effectiveOrientation);
|
||||
end
|
||||
|
||||
local function orientHorizontal(region)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
bar.GetRealSize = GetRealSize["HORIZONTAL"][region.iconVisible or false]
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
-- Align icon and bar
|
||||
if region.iconVisible then
|
||||
if region.icon_side == "LEFT" then
|
||||
icon:SetPoint("LEFT", region, "LEFT");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "TOPRIGHT");
|
||||
else
|
||||
icon:SetPoint("RIGHT", region, "RIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT");
|
||||
bar:SetPoint("TOPRIGHT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation(region.effectiveOrientation);
|
||||
end
|
||||
|
||||
local function orientVerticalInverse(region)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
bar.GetRealSize = GetRealSize["VERTICAL"][region.iconVisible or false]
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
-- Align icon and bar
|
||||
if region.iconVisible then
|
||||
if region.icon_side == "LEFT" then
|
||||
icon:SetPoint("TOP", region, "TOP");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT");
|
||||
else
|
||||
icon:SetPoint("BOTTOM", region, "BOTTOM");
|
||||
bar:SetPoint("TOPRIGHT", region, "TOPRIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation("VERTICAL_INVERSE");
|
||||
end
|
||||
|
||||
local function orientVertical(region)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
bar.GetRealSize = GetRealSize["VERTICAL"][region.iconVisible or false]
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
-- Align icon and bar
|
||||
if region.iconVisible then
|
||||
if region.icon_side == "LEFT" then
|
||||
icon:SetPoint("TOP", region, "TOP");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT");
|
||||
else
|
||||
icon:SetPoint("BOTTOM", region, "BOTTOM");
|
||||
bar:SetPoint("TOPRIGHT", region, "TOPRIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation("VERTICAL");
|
||||
end
|
||||
|
||||
local function GetTexCoordZoom(texWidth)
|
||||
local texCoord = {texWidth, texWidth, texWidth, 1 - texWidth, 1 - texWidth, texWidth, 1 - texWidth, 1 - texWidth}
|
||||
return unpack(texCoord)
|
||||
end
|
||||
|
||||
local funcs = {
|
||||
AnchorSubRegion = function(self, subRegion, anchorType, selfPoint, anchorPoint, anchorXOffset, anchorYOffset)
|
||||
if anchorType == "area" then
|
||||
@@ -616,9 +766,11 @@ local funcs = {
|
||||
end
|
||||
end,
|
||||
SetIconColor = function(self, r, g, b, a)
|
||||
self.icon_color = {r, g, b, a}
|
||||
self.icon:SetVertexColor(r, g, b, a);
|
||||
end,
|
||||
SetIconDesaturated = function(self, b)
|
||||
self.desaturateIcon = b
|
||||
self.icon:SetDesaturated(b);
|
||||
end,
|
||||
SetBackgroundColor = function (self, r, g, b, a)
|
||||
@@ -679,6 +831,38 @@ local funcs = {
|
||||
self:UpdateEffectiveOrientation()
|
||||
self.bar:SetValue(self.bar:GetValue());
|
||||
end,
|
||||
|
||||
SetIconVisible = function(self, iconVisible)
|
||||
if (self.iconVisible == iconVisible) then
|
||||
return
|
||||
end
|
||||
|
||||
self.iconVisible = iconVisible
|
||||
|
||||
local icon = self.icon
|
||||
if self.iconVisible then
|
||||
-- Update icon
|
||||
local iconsize = math.min(self.height, self.width);
|
||||
icon:SetWidth(iconsize);
|
||||
icon:SetHeight(iconsize);
|
||||
self.bar.iconWidth = iconsize
|
||||
self.bar.iconHeight = iconsize
|
||||
local texWidth = 0.25 * self.zoom;
|
||||
icon:SetTexCoord(GetTexCoordZoom(texWidth))
|
||||
icon:SetDesaturated(self.desaturateIcon);
|
||||
icon:SetVertexColor(self.icon_color[1], self.icon_color[2], self.icon_color[3], self.icon_color[4]);
|
||||
|
||||
-- Update icon visibility
|
||||
icon:Show();
|
||||
else
|
||||
self.bar.iconWidth = 0
|
||||
self.bar.iconHeight = 0
|
||||
icon:Hide();
|
||||
end
|
||||
|
||||
self:ReOrient()
|
||||
self.subRegionEvents:Notify("OrientationChanged")
|
||||
end,
|
||||
SetOverlayColor = function(self, id, r, g, b, a)
|
||||
self.bar:SetAdditionalBarColor(id, { r, g, b, a});
|
||||
end,
|
||||
@@ -687,6 +871,42 @@ local funcs = {
|
||||
end,
|
||||
GetInverse = function(self)
|
||||
return self.inverseDirection
|
||||
end,
|
||||
ReOrient = function(self)
|
||||
if self.effectiveOrientation == "HORIZONTAL_INVERSE" then
|
||||
orientHorizontalInverse(self);
|
||||
elseif self.effectiveOrientation == "HORIZONTAL" then
|
||||
orientHorizontal(self);
|
||||
elseif self.effectiveOrientation == "VERTICAL_INVERSE" then
|
||||
orientVerticalInverse(self);
|
||||
elseif self.effectiveOrientation == "VERTICAL" then
|
||||
orientVertical(self);
|
||||
end
|
||||
end,
|
||||
UpdateEffectiveOrientation = function(self)
|
||||
local orientation = self.orientation
|
||||
|
||||
if self.flipX then
|
||||
if self.orientation == "HORIZONTAL" then
|
||||
orientation = "HORIZONTAL_INVERSE"
|
||||
elseif self.orientation == "HORIZONTAL_INVERSE" then
|
||||
orientation = "HORIZONTAL"
|
||||
end
|
||||
end
|
||||
if self.flipY then
|
||||
if self.orientation == "VERTICAL" then
|
||||
orientation = "VERTICAL_INVERSE"
|
||||
elseif self.orientation == "VERTICAL_INVERSE" then
|
||||
orientation = "VERTICAL"
|
||||
end
|
||||
end
|
||||
|
||||
if orientation ~= self.effectiveOrientation then
|
||||
self.effectiveOrientation = orientation
|
||||
self:ReOrient()
|
||||
end
|
||||
|
||||
self.subRegionEvents:Notify("OrientationChanged")
|
||||
end
|
||||
}
|
||||
|
||||
@@ -746,151 +966,6 @@ local function create(parent)
|
||||
return region;
|
||||
end
|
||||
|
||||
local GetRealSize = {
|
||||
["HORIZONTAL"] = {
|
||||
[true] = function(self)
|
||||
return self.totalWidth - self.iconWidth, self.totalHeight
|
||||
end,
|
||||
[false] = function(self)
|
||||
return self.totalWidth, self.totalHeight
|
||||
end
|
||||
},
|
||||
["VERTICAL"] = {
|
||||
[true] = function(self)
|
||||
return self.totalWidth, self.totalHeight - self.iconHeight
|
||||
end,
|
||||
[false] = function(self)
|
||||
return self.totalWidth, self.totalHeight
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
-- Orientation helper methods
|
||||
local function orientHorizontalInverse(region, data)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
bar.GetRealSize = GetRealSize["HORIZONTAL"][data.icon or false]
|
||||
|
||||
-- Align icon and bar
|
||||
if data.icon then
|
||||
if data.icon_side == "LEFT" then
|
||||
icon:SetPoint("LEFT", region, "LEFT");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "TOPRIGHT");
|
||||
else
|
||||
icon:SetPoint("RIGHT", region, "RIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT");
|
||||
bar:SetPoint("TOPRIGHT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation(region.effectiveOrientation);
|
||||
end
|
||||
|
||||
local function orientHorizontal(region, data)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
bar.GetRealSize = GetRealSize["HORIZONTAL"][data.icon or false]
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
-- Align icon and bar
|
||||
if data.icon then
|
||||
if data.icon_side == "LEFT" then
|
||||
icon:SetPoint("LEFT", region, "LEFT");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "TOPRIGHT");
|
||||
else
|
||||
icon:SetPoint("RIGHT", region, "RIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", region, "BOTTOMLEFT");
|
||||
bar:SetPoint("TOPRIGHT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation(region.effectiveOrientation);
|
||||
end
|
||||
|
||||
local function orientVerticalInverse(region, data)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
bar.GetRealSize = GetRealSize["VERTICAL"][data.icon or false]
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
-- Align icon and bar
|
||||
if data.icon then
|
||||
if data.icon_side == "LEFT" then
|
||||
icon:SetPoint("TOP", region, "TOP");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT");
|
||||
else
|
||||
icon:SetPoint("BOTTOM", region, "BOTTOM");
|
||||
bar:SetPoint("TOPRIGHT", region, "TOPRIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation("VERTICAL_INVERSE");
|
||||
end
|
||||
|
||||
local function orientVertical(region, data)
|
||||
-- Localize
|
||||
local bar, icon = region.bar, region.icon;
|
||||
|
||||
bar.GetRealSize = GetRealSize["VERTICAL"][data.icon or false]
|
||||
|
||||
-- Reset
|
||||
icon:ClearAllPoints();
|
||||
bar:ClearAllPoints();
|
||||
|
||||
-- Align icon and bar
|
||||
if data.icon then
|
||||
if data.icon_side == "LEFT" then
|
||||
icon:SetPoint("TOP", region, "TOP");
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", icon, "BOTTOMLEFT");
|
||||
else
|
||||
icon:SetPoint("BOTTOM", region, "BOTTOM");
|
||||
bar:SetPoint("TOPRIGHT", region, "TOPRIGHT");
|
||||
bar:SetPoint("BOTTOMLEFT", icon, "TOPLEFT");
|
||||
end
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", region, "BOTTOMRIGHT");
|
||||
bar:SetPoint("TOPLEFT", region, "TOPLEFT");
|
||||
end
|
||||
|
||||
-- Save orientation
|
||||
bar:SetOrientation("VERTICAL");
|
||||
end
|
||||
|
||||
local function GetTexCoordZoom(texWidth)
|
||||
local texCoord = {texWidth, texWidth, texWidth, 1 - texWidth, 1 - texWidth, texWidth, 1 - texWidth, 1 - texWidth}
|
||||
return unpack(texCoord)
|
||||
end
|
||||
|
||||
local function TimerTick(self)
|
||||
local state = self.state
|
||||
local duration = state.duration or 0
|
||||
@@ -927,6 +1002,11 @@ local function modify(parent, region, data)
|
||||
region.effectiveOrientation = nil
|
||||
|
||||
region.overlayclip = data.overlayclip;
|
||||
region.iconVisible = data.icon
|
||||
region.icon_side = data.icon_side
|
||||
region.icon_color = CopyTable(data.icon_color)
|
||||
region.desaturateIcon = data.desaturate
|
||||
region.zoom = data.zoom
|
||||
|
||||
region.overlays = {};
|
||||
if (data.overlays) then
|
||||
@@ -938,7 +1018,7 @@ local function modify(parent, region, data)
|
||||
bar:SetStatusBarTexture(texturePath);
|
||||
bar:SetBackgroundColor(data.backgroundColor[1], data.backgroundColor[2], data.backgroundColor[3], data.backgroundColor[4]);
|
||||
-- Update spark settings
|
||||
WeakAuras.SetTexture(bar.spark, data.sparkTexture);
|
||||
bar.spark:SetTexture(data.sparkTexture);
|
||||
bar.spark:SetVertexColor(data.sparkColor[1], data.sparkColor[2], data.sparkColor[3], data.sparkColor[4]);
|
||||
bar.spark:SetWidth(data.sparkWidth);
|
||||
bar.spark:SetHeight(data.sparkHeight);
|
||||
@@ -977,7 +1057,7 @@ local function modify(parent, region, data)
|
||||
local textDegrees = data.rotateText == "LEFT" and 90 or data.rotateText == "RIGHT" and -90 or 0;
|
||||
|
||||
-- Update icon visibility
|
||||
if data.icon then
|
||||
if region.iconVisible then
|
||||
-- Update icon
|
||||
local iconsize = math.min(region.height, region.width);
|
||||
icon:SetWidth(iconsize);
|
||||
@@ -999,40 +1079,6 @@ local function modify(parent, region, data)
|
||||
|
||||
region.inverseDirection = data.inverse;
|
||||
|
||||
region.UpdateEffectiveOrientation = function()
|
||||
local orientation = region.orientation
|
||||
|
||||
if region.flipX then
|
||||
if region.orientation == "HORIZONTAL" then
|
||||
orientation = "HORIZONTAL_INVERSE"
|
||||
elseif region.orientation == "HORIZONTAL_INVERSE" then
|
||||
orientation = "HORIZONTAL"
|
||||
end
|
||||
end
|
||||
if region.flipY then
|
||||
if region.orientation == "VERTICAL" then
|
||||
orientation = "VERTICAL_INVERSE"
|
||||
elseif region.orientation == "VERTICAL_INVERSE" then
|
||||
orientation = "VERTICAL"
|
||||
end
|
||||
end
|
||||
|
||||
if orientation ~= region.effectiveOrientation then
|
||||
region.effectiveOrientation = orientation
|
||||
if region.effectiveOrientation == "HORIZONTAL_INVERSE" then
|
||||
orientHorizontalInverse(region, data);
|
||||
elseif region.effectiveOrientation == "HORIZONTAL" then
|
||||
orientHorizontal(region, data);
|
||||
elseif region.effectiveOrientation == "VERTICAL_INVERSE" then
|
||||
orientVerticalInverse(region, data);
|
||||
elseif region.effectiveOrientation == "VERTICAL" then
|
||||
orientVertical(region, data);
|
||||
end
|
||||
end
|
||||
|
||||
region.subRegionEvents:Notify("OrientationChanged")
|
||||
end
|
||||
|
||||
-- Apply orientation alignment
|
||||
region:UpdateEffectiveOrientation()
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ local screenWidth, screenHeight = math.ceil(GetScreenWidth() / 20) * 20, math.ce
|
||||
function WeakAuras.GetAnchorsForData(parentData, type)
|
||||
local result
|
||||
if not parentData.controlledChildren then
|
||||
if not WeakAuras.regionOptions[parentData.regionType].getAnchors then
|
||||
if not WeakAuras.regionOptions[parentData.regionType] or not WeakAuras.regionOptions[parentData.regionType].getAnchors then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -258,7 +258,7 @@ local function SendChat(self, options)
|
||||
if (not options or WeakAuras.IsOptionsOpen()) then
|
||||
return
|
||||
end
|
||||
WeakAuras.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_channel, options.r, options.g, options.b, self, options.message_custom);
|
||||
WeakAuras.HandleChatAction(options.message_type, options.message, options.message_dest, options.message_channel, options.r, options.g, options.b, self, options.message_custom, nil, options.message_formaters);
|
||||
end
|
||||
|
||||
local function RunCode(self, func)
|
||||
@@ -532,6 +532,22 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
|
||||
WeakAuras.AnchorFrame(data, region, parent);
|
||||
end
|
||||
end
|
||||
|
||||
region.startFormatters = WeakAuras.CreateFormatters(data.actions.start.message, function(key, default)
|
||||
local fullKey = "message_format_" .. key
|
||||
if data.actions.start[fullKey] == nil then
|
||||
data.actions.start[fullKey] = default
|
||||
end
|
||||
return data.actions.start[fullKey]
|
||||
end)
|
||||
|
||||
region.finishFormatters = WeakAuras.CreateFormatters(data.actions.finish.message, function(key, default)
|
||||
local fullKey = "message_format_" .. key
|
||||
if data.actions.finish[fullKey] == nil then
|
||||
data.actions.finish[fullKey] = default
|
||||
end
|
||||
return data.actions.finish[fullKey]
|
||||
end)
|
||||
end
|
||||
|
||||
function WeakAuras.regionPrototype.modifyFinish(parent, region, data)
|
||||
@@ -849,7 +865,3 @@ function WeakAuras.regionPrototype.AddExpandFunction(data, region, cloneId, pare
|
||||
function region:Expand() end
|
||||
end
|
||||
end
|
||||
|
||||
function WeakAuras.SetTexture(texture, path, wrapModeH, wrapModeV)
|
||||
texture:SetTexture(path, wrapModeH, wrapModeV);
|
||||
end
|
||||
|
||||
@@ -6,7 +6,6 @@ local L = WeakAuras.L;
|
||||
local defaultFont = WeakAuras.defaultFont
|
||||
local defaultFontSize = WeakAuras.defaultFontSize
|
||||
|
||||
|
||||
local default = {
|
||||
displayText = "%p",
|
||||
outline = "OUTLINE",
|
||||
@@ -76,8 +75,6 @@ local function modify(parent, region, data)
|
||||
local text = region.text;
|
||||
|
||||
region.useAuto = WeakAuras.CanHaveAuto(data);
|
||||
region.progressPrecision = data.progressPrecision;
|
||||
region.totalPrecision = data.totalPrecision;
|
||||
|
||||
local fontPath = SharedMedia:Fetch("font", data.font);
|
||||
text:SetFont(fontPath, data.fontSize, data.outline);
|
||||
@@ -161,9 +158,17 @@ local function modify(parent, region, data)
|
||||
|
||||
local UpdateText
|
||||
if WeakAuras.ContainsAnyPlaceHolders(data.displayText) then
|
||||
local getter = function(key, default)
|
||||
local fullKey = "displayText_format_" .. key
|
||||
if (data[fullKey] == nil) then
|
||||
data[fullKey] = default
|
||||
end
|
||||
return data[fullKey]
|
||||
end
|
||||
local formatters = WeakAuras.CreateFormatters(data.displayText, getter)
|
||||
UpdateText = function()
|
||||
local textStr = data.displayText;
|
||||
textStr = WeakAuras.ReplacePlaceHolders(textStr, region, nil);
|
||||
textStr = WeakAuras.ReplacePlaceHolders(textStr, region, nil, false, formatters);
|
||||
if (textStr == nil or textStr == "") then
|
||||
textStr = " ";
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ end
|
||||
|
||||
local function modify(parent, region, data)
|
||||
WeakAuras.regionPrototype.modify(parent, region, data);
|
||||
WeakAuras.SetTexture(region.texture, data.texture);
|
||||
region.texture:SetTexture(data.texture);
|
||||
region.texture:SetDesaturated(data.desaturate)
|
||||
region:SetWidth(data.width);
|
||||
region:SetHeight(data.height);
|
||||
@@ -182,7 +182,7 @@ local function modify(parent, region, data)
|
||||
|
||||
function region:Update()
|
||||
if region.state.texture then
|
||||
WeakAuras.SetTexture(region.texture, region.state.texture);
|
||||
region.texture:SetTexture(region.state.texture);
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user