from retail
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, Private = ...
|
||||
local L = WeakAuras.L;
|
||||
|
||||
do
|
||||
local function subSupports(regionType)
|
||||
return regionType ~= "group" and regionType ~= "dynamicgroup"
|
||||
end
|
||||
|
||||
local function noop()
|
||||
end
|
||||
|
||||
local function subSetFrameLevel(self, level)
|
||||
self.parent:SetFrameLevel(level)
|
||||
end
|
||||
|
||||
local function subCreate()
|
||||
return { Update = noop, SetFrameLevel = subSetFrameLevel}
|
||||
end
|
||||
|
||||
local function subModify(parent, region)
|
||||
region.parent = parent
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionType("subbackground", L["Background"], subSupports, subCreate, subModify, noop, noop, {}, nil, {}, false);
|
||||
end
|
||||
|
||||
-- Foreground for aurabar
|
||||
|
||||
do
|
||||
local function subSupports(regionType)
|
||||
return regionType == "aurabar"
|
||||
end
|
||||
|
||||
local function noop()
|
||||
end
|
||||
|
||||
local function subSetFrameLevel(self, level)
|
||||
if self.parent.bar then
|
||||
self.parent.bar:SetFrameLevel(level)
|
||||
end
|
||||
if self.parent.iconFrame then
|
||||
self.parent.iconFrame:SetFrameLevel(level)
|
||||
end
|
||||
end
|
||||
|
||||
local function subCreate()
|
||||
return { Update = noop, SetFrameLevel = subSetFrameLevel}
|
||||
end
|
||||
|
||||
local function subModify(parent, region)
|
||||
region.parent = parent
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionType("subforeground", L["Foreground"], subSupports, subCreate, subModify, noop, noop, {}, nil, {}, false);
|
||||
end
|
||||
@@ -177,18 +177,17 @@ local funcs = {
|
||||
if MSQ and self.parentType == "icon" then
|
||||
if (visible) then
|
||||
self.__MSQ_Shape = self:GetParent().button.__MSQ_Shape
|
||||
self:Show()
|
||||
glowStart(self, self, color);
|
||||
else
|
||||
self.glowStop(self);
|
||||
self:Hide()
|
||||
end
|
||||
elseif (visible) then
|
||||
self:Show()
|
||||
glowStart(self, self, color);
|
||||
else
|
||||
self.glowStop(self);
|
||||
end
|
||||
if visible then
|
||||
self:Show()
|
||||
else
|
||||
self:Hide()
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -8,8 +8,9 @@ Private.barmodels = {}
|
||||
|
||||
local default = function(parentType)
|
||||
return {
|
||||
bar_model_visible = true,
|
||||
bar_model_alpha = 1,
|
||||
model_visible = true,
|
||||
model_alpha = 1,
|
||||
|
||||
model_x = 0,
|
||||
model_y = 0,
|
||||
model_z = 0,
|
||||
@@ -21,13 +22,13 @@ local default = function(parentType)
|
||||
end
|
||||
|
||||
local properties = {
|
||||
bar_model_visible = {
|
||||
model_visible = {
|
||||
display = L["Visibility"],
|
||||
setter = "SetVisible",
|
||||
type = "bool",
|
||||
defaultProperty = true
|
||||
},
|
||||
bar_model_alpha = {
|
||||
model_alpha = {
|
||||
display = L["Alpha"],
|
||||
setter = "SetAlpha",
|
||||
type = "number",
|
||||
@@ -66,11 +67,22 @@ local function AcquireModel(region, data)
|
||||
|
||||
model:ClearAllPoints()
|
||||
|
||||
local anchor
|
||||
if region.parentType == "aurabar" then
|
||||
model:SetAllPoints(region.parent.bar)
|
||||
anchor = region.parent.bar
|
||||
else
|
||||
model:SetAllPoints(region.parent)
|
||||
anchor = region.parent
|
||||
end
|
||||
|
||||
local extra_width, extra_height = 0, 0
|
||||
if not(data.bar_model_clip and region.parentType == "aurabar") then
|
||||
extra_width = data.extra_width or 0
|
||||
extra_height = data.extra_height or 0
|
||||
end
|
||||
|
||||
model:SetPoint("TOPLEFT", anchor ,"TOPLEFT", -extra_width/2, extra_height/2)
|
||||
model:SetPoint("BOTTOMRIGHT", anchor ,"BOTTOMRIGHT", extra_width/2, -extra_height/2)
|
||||
|
||||
model:SetParent(region)
|
||||
--model:SetKeepModelOnHide(true)
|
||||
model:Show()
|
||||
@@ -162,6 +174,8 @@ local function onRelease(subRegion)
|
||||
subRegion:Hide()
|
||||
end
|
||||
|
||||
|
||||
|
||||
local function modify(parent, region, parentData, data, first)
|
||||
if region.model then
|
||||
ReleaseModel(region.model)
|
||||
@@ -174,18 +188,28 @@ local function modify(parent, region, parentData, data, first)
|
||||
|
||||
region:SetParent(parent)
|
||||
|
||||
local anchor
|
||||
if parentData.regionType == "aurabar" then
|
||||
if data.bar_model_clip then
|
||||
region:SetAllPoints(parent.bar.fgFrame)
|
||||
anchor = parent.bar.fgFrame
|
||||
else
|
||||
region:SetAllPoints(parent.bar)
|
||||
anchor = parent.bar
|
||||
end
|
||||
else
|
||||
region:SetAllPoints(parent)
|
||||
anchor = parent
|
||||
end
|
||||
|
||||
region:SetAlpha(data.bar_model_alpha)
|
||||
region:SetVisible(data.bar_model_visible)
|
||||
local extra_width, extra_height = 0, 0
|
||||
if not(data.bar_model_clip and parentData.regionType == "aurabar") then
|
||||
extra_width = data.extra_width or 0
|
||||
extra_height = data.extra_height or 0
|
||||
end
|
||||
|
||||
region:SetPoint("TOPLEFT", anchor ,"TOPLEFT", -extra_width/2, extra_height/2)
|
||||
region:SetPoint("BOTTOMRIGHT", anchor ,"BOTTOMRIGHT", extra_width/2, -extra_height/2)
|
||||
|
||||
region:SetAlpha(data.model_alpha)
|
||||
region:SetVisible(data.model_visible)
|
||||
|
||||
parent.subRegionEvents:AddSubscriber("AlphaChanged", region)
|
||||
parent.subRegionEvents:AddSubscriber("PreShow", region)
|
||||
@@ -193,7 +217,11 @@ local function modify(parent, region, parentData, data, first)
|
||||
end
|
||||
|
||||
local function supports(regionType)
|
||||
return regionType == "aurabar" or regionType == "icon"
|
||||
return regionType == "texture"
|
||||
or regionType == "progresstexture"
|
||||
or regionType == "icon"
|
||||
or regionType == "aurabar"
|
||||
or regionType == "text"
|
||||
end
|
||||
|
||||
WeakAuras.RegisterSubRegionType("subbarmodel", L["Model"], supports, create, modify, onAcquire, onRelease, default, nil, properties);
|
||||
WeakAuras.RegisterSubRegionType("submodel", L["Model"], supports, create, modify, onAcquire, onRelease, default, nil, properties);
|
||||
@@ -197,7 +197,7 @@ local funcs = {
|
||||
end
|
||||
end,
|
||||
UpdateTimerTick = function(self)
|
||||
if self.tick_placement_mode == "ValueOffset" and self.state and self.state.progressType == "timed" then
|
||||
if self.tick_placement_mode == "ValueOffset" and self.state and self.state.progressType == "timed" and not self.paused then
|
||||
if not self.TimerTick then
|
||||
self.TimerTick = self.UpdateTickPlacement
|
||||
self.parent:UpdateRegionHasTimerTick()
|
||||
@@ -237,7 +237,13 @@ local funcs = {
|
||||
elseif self.tick_placement_mode == "ValueOffset" then
|
||||
if self.trigger_total and self.trigger_total ~= 0 then
|
||||
if self.state.progressType == "timed" then
|
||||
tick_placement = self.state.expirationTime - GetTime() + self.tick_placement
|
||||
if self.state.paused then
|
||||
if self.state.remaining then
|
||||
tick_placement = self.state.remaining + self.tick_placement
|
||||
end
|
||||
else
|
||||
tick_placement = self.state.expirationTime - GetTime() + self.tick_placement
|
||||
end
|
||||
else
|
||||
tick_placement = self.state.value + self.tick_placement
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user