from retail

diffchecked
This commit is contained in:
NoM0Re
2025-02-14 18:46:41 +01:00
parent 436041dd92
commit 290981ff25
22 changed files with 297 additions and 243 deletions
+3
View File
@@ -873,7 +873,9 @@ local funcs = {
if (self.total ~= 0) then
progress = self.value / self.total;
end
self:SetProgress(progress)
if self.FrameTick then
self.FrameTick = nil
self.subRegionEvents:RemoveSubscriber("FrameTick", self)
@@ -886,6 +888,7 @@ local funcs = {
progress = 1 - progress;
end
self:SetProgress(progress)
if self.paused and self.FrameTick then
self.FrameTick = nil
self.subRegionEvents:RemoveSubscriber("FrameTick", self)
+14 -11
View File
@@ -48,7 +48,8 @@ Private.regionPrototype.AddAlphaToDefault(default);
local controlPointFunctions = {
["SetAnchorPoint"] = function(self, point, relativeFrame, relativePoint, offsetX, offsetY)
self:ClearAllPoints();
self.point, self.relativeFrame, self.relativePoint, self.offsetX, self.offsetY = point, relativeFrame, relativePoint, offsetX, offsetY
self.point, self.relativeFrame, self.relativePoint, self.offsetX, self.offsetY
= point, relativeFrame, relativePoint, offsetX, offsetY
self.totalOffsetX = (self.animOffsetX or 0) + (self.offsetX or 0)
self.totalOffsetY = (self.animOffsetY or 0) + (self.offsetY or 0)
if self.relativeFrame and self.relativePoint then
@@ -96,7 +97,7 @@ end
local function releaseControlPoint(self, controlPoint)
controlPoint:Hide()
controlPoint:ClearAnchorPoint()
controlPoint:SetAnchorPoint(self.parent.selfPoint)
local regionData = controlPoint.regionData
if regionData then
if self.parent.anchorPerUnit == "UNITFRAME" then
@@ -457,7 +458,7 @@ local centeredIndexerStart = {
if maxIndex % 2 == 1 then
return maxIndex
else
return maxIndex > 0 and maxIndex - 1 or nil
return maxIndex > 0 and maxIndex - 1 or nil
end
end
}
@@ -506,7 +507,7 @@ local centeredIndexerNext = {
}
local function createAnchorPerUnitFunc(data)
local anchorer = anchorers[data.anchorPerUnit] or anchorers.NAMEPLATE or anchorers.UNITFRAME
local anchorer = anchorers[data.anchorPerUnit] or anchorers.NAMEPLATE
return anchorer(data)
end
@@ -1065,8 +1066,10 @@ local function modify(parent, region, data)
bottom = data.borderInset,
},
});
background:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2], data.borderColor[3], data.borderColor[4]);
background:SetBackdropColor(data.backdropColor[1], data.backdropColor[2], data.backdropColor[3], data.backdropColor[4]);
background:SetBackdropBorderColor(data.borderColor[1], data.borderColor[2],
data.borderColor[3], data.borderColor[4]);
background:SetBackdropColor(data.backdropColor[1], data.backdropColor[2],
data.backdropColor[3], data.backdropColor[4]);
background:ClearAllPoints();
background:SetPoint("bottomleft", region, "bottomleft", -1 * data.borderOffset, -1 * data.borderOffset)
@@ -1368,13 +1371,13 @@ local function modify(parent, region, data)
controlPoint:SetWidth(regionData.dimensions.width)
controlPoint:SetHeight(regionData.dimensions.height)
if (data.anchorFrameParent or data.anchorFrameParent == nil)
and (data.useAnchorPerUnit
and (
data.useAnchorPerUnit
or (
not data.useAnchorPerUnit
and not (data.anchorFrameType == "SCREEN"
or data.anchorFrameType == "UIPARENT"
or data.anchorFrameType == "MOUSE")
))
and not (data.anchorFrameType == "SCREEN" or data.anchorFrameType == "UIPARENT" or data.anchorFrameType == "MOUSE")
)
)
then
local parent
if frame == "" then
+15 -7
View File
@@ -121,11 +121,15 @@ local function GetTexCoord(region, texWidth, aspectRatio, xOffset, yOffset)
local db = region.MSQGroup.db
if db and not db.Disabled then
usesMasque = true
region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4], region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8] = region.icon:GetTexCoord()
region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4],
region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8]
= region.icon:GetTexCoord()
end
end
if (not usesMasque) then
region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4], region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8] = 0, 0, 0, 1, 1, 0, 1, 1;
region.currentCoord[1], region.currentCoord[2], region.currentCoord[3], region.currentCoord[4],
region.currentCoord[5], region.currentCoord[6], region.currentCoord[7], region.currentCoord[8]
= 0, 0, 0, 1, 1, 0, 1, 1;
end
local xRatio = aspectRatio < 1 and aspectRatio or 1;
@@ -149,8 +153,7 @@ local function AnchorSubRegion(self, subRegion, anchorType, anchorPoint, selfPoi
if anchorType == "area" then
Private.regionPrototype.AnchorSubRegion(selfPoint == "region" and self or self.icon,
subRegion, anchorType, anchorPoint,
selfPoint, anchorXOffset, anchorYOffset)
subRegion, anchorType, anchorPoint, selfPoint, anchorXOffset, anchorYOffset)
else
subRegion:ClearAllPoints()
anchorPoint = anchorPoint or "CENTER"
@@ -313,7 +316,8 @@ local function create(parent, data)
icon.SetTexture = setTexture
--This section creates a unique frame id for the cooldown frame so that it can be created with a global reference
--The reason is so that WeakAuras cooldown frames can interact properly with OmniCC (i.e., put on its ignore list for timer overlays)
--The reason is so that WeakAuras cooldown frames can interact properly with OmniCC
-- (i.e., put on its ignore list for timer overlays)
local id = data.id;
local frameId = id:lower():gsub(" ", "_");
if(_G["WeakAurasCooldown"..frameId]) then
@@ -465,13 +469,15 @@ local function modify(parent, region, data)
if region.inverseDirection == inverse then
return
end
region.inverseDirection = inverse
region:UpdateEffectiveInverse()
end
function region:UpdateEffectiveInverse()
-- If cooldown.inverse == false then effectiveReverse = not inverse
-- If cooldown.inverse == true then effectiveReverse = inverse
local effectiveReverse = not region.inverseDirection == not cooldown.inverse
local effectiveReverse = not region.inverseDirection == not cooldown.inverse
cooldown:SetReverse(effectiveReverse)
if (cooldown.expirationTime and cooldown.duration and cooldown:IsShown()) then
-- WORKAROUND SetReverse not applying until next frame
@@ -481,6 +487,7 @@ local function modify(parent, region, data)
cooldown.useCooldownModRate and cooldown.modRate or nil)
end
end
region:SetInverse(data.inverse)
function region:Color(r, g, b, a)
@@ -491,7 +498,8 @@ local function modify(parent, region, data)
if (r or g or b) then
a = a or 1;
end
icon:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g, region.color_anim_b or b, region.color_anim_a or a);
icon:SetVertexColor(region.color_anim_r or r, region.color_anim_g or g,
region.color_anim_b or b, region.color_anim_a or a)
if region.button then
region.button:SetAlpha(region.color_anim_a or a or 1);
end
+7 -1
View File
@@ -482,7 +482,6 @@ local function UpdateProgressFromState(self, minMaxConfig, state, progressSource
else
max = duration
end
self.minProgress, self.maxProgress = adjustMin, max
self.progressType = "timed"
self.duration = max - adjustMin
@@ -520,6 +519,7 @@ local function UpdateProgressFromState(self, minMaxConfig, state, progressSource
else
max = duration
end
self.minProgress, self.maxProgress = adjustMin, max
self.progressType = "timed"
self.duration = max - adjustMin
@@ -703,6 +703,7 @@ function Private.regionPrototype.create(region)
region.RunCode = RunCode;
region.GlowExternal = GlowExternal;
region.ReAnchor = UpdatePosition;
region.SetAnchor = SetAnchor;
region.SetOffset = SetOffset;
region.SetXOffset = SetXOffset;
@@ -778,17 +779,22 @@ function Private.regionPrototype.AddMinMaxProgressSource(hasProgressSource, regi
end
end
end
function Private.regionPrototype.modify(parent, region, data)
region.state = nil
region.states = nil
region.subRegionEvents:ClearSubscribers()
region.subRegionEvents:ClearCallbacks()
Private.FrameTick:RemoveSubscriber("Tick", region)
local defaultsForRegion = Private.regionTypes[data.regionType] and Private.regionTypes[data.regionType].default;
if region.SetRegionAlpha then
region:SetRegionAlpha(data.alpha)
end
local hasProgressSource = defaultsForRegion and defaultsForRegion.progressSource
Private.regionPrototype.AddMinMaxProgressSource(hasProgressSource, region, data, data)
region:SetOffset(data.xOffset or 0, data.yOffset or 0);
+34 -34
View File
@@ -7,26 +7,26 @@ local AddonName, Private = ...
local g_updatingBars = {};
local function IsCloseEnough(bar, newValue, targetValue)
local min, max = bar:GetMinMaxValues();
local range = max - min;
if range > 0.0 then
return math.abs((newValue - targetValue) / range) < 0.00001;
end
local min, max = bar:GetMinMaxValues();
local range = max - min;
if range > 0.0 then
return math.abs((newValue - targetValue) / range) < 0.00001;
end
return true;
return true;
end
local function ProcessSmoothStatusBars(self, elapsed)
for bar, targetValue in pairs(g_updatingBars) do
local newValue = FrameDeltaLerp(bar:GetValue(), targetValue, 0.25, elapsed);
for bar, targetValue in pairs(g_updatingBars) do
local newValue = FrameDeltaLerp(bar:GetValue(), targetValue, 0.25, elapsed);
if IsCloseEnough(bar, newValue, targetValue) then
g_updatingBars[bar] = nil;
bar:SetValue(targetValue);
else
bar:SetValue(newValue);
end
end
if IsCloseEnough(bar, newValue, targetValue) then
g_updatingBars[bar] = nil;
bar:SetValue(targetValue);
else
bar:SetValue(newValue);
end
end
end
CreateFrame("Frame"):SetScript("OnUpdate", ProcessSmoothStatusBars);
@@ -34,32 +34,32 @@ CreateFrame("Frame"):SetScript("OnUpdate", ProcessSmoothStatusBars);
Private.SmoothStatusBarMixin = {};
function Private.SmoothStatusBarMixin:ResetSmoothedValue(value) --If nil, tries to set to the last target value
local targetValue = g_updatingBars[self];
if targetValue then
g_updatingBars[self] = nil;
self:SetValue(value or targetValue);
elseif value then
self:SetValue(value);
end
local targetValue = g_updatingBars[self];
if targetValue then
g_updatingBars[self] = nil;
self:SetValue(value or targetValue);
elseif value then
self:SetValue(value);
end
end
function Private.SmoothStatusBarMixin:SetSmoothedValue(value)
g_updatingBars[self] = value;
g_updatingBars[self] = value;
end
function Private.SmoothStatusBarMixin:SetMinMaxSmoothedValue(min, max)
self:SetMinMaxValues(min, max);
self:SetMinMaxValues(min, max);
local targetValue = g_updatingBars[self];
if targetValue then
local ratio = 1;
if max ~= 0 and self.lastSmoothedMax and self.lastSmoothedMax ~= 0 then
ratio = max / self.lastSmoothedMax;
end
local targetValue = g_updatingBars[self];
if targetValue then
local ratio = 1;
if max ~= 0 and self.lastSmoothedMax and self.lastSmoothedMax ~= 0 then
ratio = max / self.lastSmoothedMax;
end
g_updatingBars[self] = targetValue * ratio;
end
g_updatingBars[self] = targetValue * ratio;
end
self.lastSmoothedMin = min;
self.lastSmoothedMax = max;
self.lastSmoothedMin = min;
self.lastSmoothedMax = max;
end
+4 -10
View File
@@ -74,20 +74,15 @@ local function modify(parent, region, data)
local text = region.text;
local fontPath = SharedMedia:Fetch("font", data.font);
text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline == "None" and "" or data.outline);
if not text:GetFont() and fontPath then -- workaround font not loading correctly
local objectName = "WeakAuras-Font-" .. data.font
local fontObject = _G[objectName] or CreateFont(objectName)
fontObject:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline == "None" and "" or data.outline)
text:SetFontObject(fontObject)
end
text:SetFont(fontPath, data.fontSize < 33 and data.fontSize or 33, data.outline);
if not text:GetFont() then -- Font invalid, set the font but keep the setting
text:SetFont(STANDARD_TEXT_FONT, data.fontSize <= 33 and data.fontSize or 33, data.outline);
end
text:SetTextHeight(data.fontSize);
if text:GetFont() then
text:SetText("")
text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(data.displayText));
text:SetFont(STANDARD_TEXT_FONT, data.fontSize < 33 and data.fontSize or 33, data.outline == "None" and "" or data.outline);
end
text:SetJustifyH(data.justify);
@@ -116,6 +111,7 @@ local function modify(parent, region, data)
region.tooltipFrame:EnableMouse(false);
end
text:SetTextHeight(data.fontSize);
text:SetShadowColor(unpack(data.shadowColor))
text:SetShadowOffset(data.shadowXOffset, data.shadowYOffset)
@@ -333,7 +329,6 @@ local function modify(parent, region, data)
region.displayText = data.displayText
region:ConfigureTextUpdate()
region:ConfigureSubscribers()
Private.regionPrototype.modifyFinish(parent, region, data);
end
@@ -349,8 +344,7 @@ local function fallbackmodify(parent, region, data)
Private.regionPrototype.modify(parent, region, data);
local text = region.text;
text:SetFont(STANDARD_TEXT_FONT, data.fontSize < 33 and data.fontSize or 33, data.outline and "OUTLINE" or nil);
text:SetTextHeight(data.fontSize);
text:SetFont(STANDARD_TEXT_FONT, data.fontSize, data.outline and "OUTLINE" or nil);
if text:GetFont() then
text:SetText(WeakAuras.L["Region type %s not supported"]:format(data.regionType));
end