from retail

This commit is contained in:
Bunny67
2020-07-26 14:30:59 +03:00
parent 0e3999b8fd
commit ad5e1ed4d1
8 changed files with 121 additions and 71 deletions
+31 -16
View File
@@ -1101,18 +1101,17 @@ local function modify(parent, region, data)
region.tooltipFrame:EnableMouse(false);
end
function region:Update()
function region:UpdateMinMax()
local state = region.state
local min
local max
if state.progressType == "timed" then
local expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge;
local duration = state.duration or 0
if region.adjustedMinRelPercent then
region.adjustedMinRel = region.adjustedMinRelPercent * duration
end
local adjustMin = region.adjustedMin or region.adjustedMinRel or 0;
min = region.adjustedMin or region.adjustedMinRel or 0;
if duration == 0 then
max = 0
@@ -1124,20 +1123,13 @@ local function modify(parent, region, data)
else
max = duration
end
region:SetTime(max - adjustMin, expirationTime - adjustMin, state.inverse);
if not region.TimerTick then
region.TimerTick = TimerTick
region:UpdateRegionHasTimerTick()
end
elseif state.progressType == "static" then
local value = state.value or 0;
local total = state.total or 0;
if region.adjustedMinRelPercent then
region.adjustedMinRel = region.adjustedMinRelPercent * total
end
local adjustMin = region.adjustedMin or region.adjustedMinRel or 0;
min = region.adjustedMin or region.adjustedMinRel or 0;
if region.adjustedMax then
max = region.adjustedMax
elseif region.adjustedMaxRelPercent then
@@ -1146,7 +1138,31 @@ local function modify(parent, region, data)
else
max = total
end
region:SetValue(value - adjustMin, max - adjustMin);
end
region.currentMin, region.currentMax = min, max
end
function region:GetMinMax()
return region.currentMin or 0, region.currentMax or 0
end
function region:Update()
local state = region.state
region:UpdateMinMax()
if state.progressType == "timed" then
local expirationTime = state.expirationTime and state.expirationTime > 0 and state.expirationTime or math.huge;
local duration = state.duration or 0
region:SetTime(region.currentMax - region.currentMin, expirationTime - region.currentMin, state.inverse);
if not region.TimerTick then
region.TimerTick = TimerTick
region:UpdateRegionHasTimerTick()
end
elseif state.progressType == "static" then
local value = state.value or 0;
local total = state.total or 0;
region:SetValue(value - region.currentMin, region.currentMax - region.currentMin);
if region.TimerTick then
region.TimerTick = nil
region:UpdateRegionHasTimerTick()
@@ -1173,9 +1189,8 @@ local function modify(parent, region, data)
icon:SetDesaturated(data.desaturate);
local duration = state.duration or 0
local min = region.adjustMin or 0
local effectiveInverse = (state.inverse and not region.inverseDirection) or (not state.inverse and region.inverseDirection);
region.bar:SetAdditionalBars(state.additionalProgress, region.overlays, min, max, effectiveInverse, region.overlayclip);
region.bar:SetAdditionalBars(state.additionalProgress, region.overlays, region.currentMin, region.currentMax, effectiveInverse, region.overlayclip);
end
-- Scale update function
+12 -4
View File
@@ -525,10 +525,18 @@ function WeakAuras.regionPrototype.modify(parent, region, data)
end
if not parent or parent.regionType ~= "dynamicgroup" then
if not (
data.anchorFrameType == "CUSTOM"
or data.anchorFrameType == "UNITFRAME"
) then
if
-- Don't anchor single Auras that with custom anchoring,
-- these will be anchored in expand
not (
data.anchorFrameType == "CUSTOM"
or data.anchorFrameType == "UNITFRAME"
)
-- Group Auras that will never be expanded, so those need
-- to be always anchored here
or data.regionType == "dynamicgroup"
or data.regionType == "group"
then
WeakAuras.AnchorFrame(data, region, parent);
end
end