This commit is contained in:
Bunny67
2020-08-08 15:48:17 +03:00
parent 13550c449c
commit 073ca1ffe3
15 changed files with 406 additions and 132 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ local function UpdateAnimations()
end
local progress = anim.inverse and (1 - anim.progress) or anim.progress;
progress = anim.easeFunc(progress, anim.easeStrength or 3)
WeakAuras.ActivateAuraEnvironment(anim.region)
WeakAuras.ActivateAuraEnvironmentForRegion(anim.region)
if(anim.translateFunc) then
if (anim.region.SetOffsetAnim) then
local ok, x, y = pcall(anim.translateFunc, progress, 0, 0, anim.dX, anim.dY);
Binary file not shown.
Binary file not shown.
+4 -4
View File
@@ -1039,15 +1039,15 @@ local function modify(parent, region, data)
function region:DoPositionChildrenPerFrame(frame, positions, handledRegionData)
for regionData, pos in pairs(positions) do
if type(regionData) ~= "table" then
break;
end
handledRegionData[regionData] = true
local x, y, show = type(pos[1]) == "number" and pos[1] or 0,
type(pos[2]) == "number" and pos[2] or 0,
type(pos[3]) ~= "boolean" and true or pos[3]
local controlPoint = type(regionData) == "table" and regionData.controlPoint
if not controlPoint then
break
end
local controlPoint = regionData.controlPoint
controlPoint:ClearAnchorPoint()
controlPoint:SetAnchorPoint(
data.selfPoint,
+3
View File
@@ -3462,6 +3462,9 @@ function WeakAuras.GetTriggerStateForTrigger(id, triggernum)
return triggerState[id][triggernum];
end
function WeakAuras.GetActiveTriggers(id)
return triggerState[id].triggers
end
do
local visibleFakeStates = {}
@@ -0,0 +1,71 @@
--[[-----------------------------------------------------------------------------
Anchor for a Expandable section
-------------------------------------------------------------------------------]]
local Type, Version = "WeakAurasExpandAnchor", 1
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
local methods = {
["OnAcquire"] = function(self)
self:SetHeight(1)
self:SetWidth(1)
end,
-- ["OnRelease"] = nil,
["OnWidthSet"] = function(self, width)
end,
["SetText"] = function(self, text)
end,
["SetFontObject"] = function(self, font)
end,
}
local function OnFrameShow(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderAnchors[option.arg.expanderName] = self
local otherWidget = WeakAuras.expanderButtons[option.arg.expanderName]
if otherWidget then
otherWidget:SetAnchor(self)
end
end
end
local function OnFrameHide(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderAnchors[option.arg.expanderName] = nil
local otherWidget = WeakAuras.expanderButtons[option.arg.expanderName]
if otherWidget then
otherWidget:SetAnchor(nil)
end
end
end
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
frame:SetScript("OnShow", OnFrameShow)
frame:SetScript("OnHide", OnFrameHide)
-- create widget
local widget = {
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -58,6 +58,15 @@ local methods = {
["SetImage"] = function(self, path, ...)
local image = self.image
if path == "collapsed" then
self:SetExpandedState(false)
path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\gear"
elseif path == "expanded" then
self:SetExpandedState(true)
path = "Interface\\AddOns\\WeakAuras\\Media\\Textures\\geardown"
else
self:SetExpandedState(false)
end
image:SetTexture(path)
if image:GetTexture() then
@@ -70,10 +79,24 @@ local methods = {
end
end,
["SetExpandedState"] = function(self, state)
self.expanded = state
if state then
self.expandedBackground:Show()
self.expandedHighlight:Show()
else
self.expandedBackground:Hide()
self.expandedHighlight:Hide()
end
end,
["GetExpandedState"] = function(self)
return self.expanded
end,
["SetImageSize"] = function(self, width, height)
self.image:SetWidth(width)
self.image:SetHeight(height)
--self.frame:SetWidth(width + 30)
self:UpdateWidth()
if self.label:IsShown() then
self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight()))
@@ -102,13 +125,50 @@ local methods = {
["UpdateWidth"] = function(self)
self.label:SetWidth(self.frame:GetWidth() - self.image:GetWidth())
if self.label:IsShown() then
self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight()))
self:SetHeight(max(self.label:GetStringHeight(), self.image:GetHeight(), 20))
else
self:SetHeight(self.image:GetHeight())
end
self.expandedBackground:SetHeight(self.frame:GetHeight()*2)
end,
["SetAnchor"] = function(self, otherWidget)
local expandedBackground = self.expandedBackground
if otherWidget then
expandedBackground:SetPoint("BOTTOMLEFT", otherWidget.frame, "TOPLEFT", -4, -2)
end
end
}
local function OnFrameShow(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderButtons[option.arg.expanderName] = self
local otherWidget = WeakAuras.expanderAnchors[option.arg.expanderName]
if otherWidget then
self:SetAnchor(otherWidget)
end
end
end
local function OnFrameHide(frame)
local self = frame.obj
local option = self.userdata.option
if option and option.arg and option.arg.expanderName then
WeakAuras.expanderButtons[option.arg.expanderName] = nil
local otherWidget = WeakAuras.expanderAnchors[option.arg.expanderName]
if otherWidget then
self:SetAnchor(nil)
end
end
end
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
@@ -120,19 +180,21 @@ local function Constructor()
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
frame:SetScript("OnClick", Button_OnClick)
frame:SetScript("OnShow", OnFrameShow)
frame:SetScript("OnHide", OnFrameHide)
local image = frame:CreateTexture(nil, "BACKGROUND")
image:SetWidth(64)
image:SetHeight(64)
image:SetPoint("RIGHT", 0, 0)
image:SetPoint("LEFT", 2, 0)
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlight")
label:SetJustifyH("LEFT")
label:SetJustifyV("CENTER")
label:SetPoint("RIGHT", image, "LEFT", -5, 0)
label:SetPoint("RIGHT")
label:SetPoint("TOP")
label:SetPoint("BOTTOM")
label:SetPoint("LEFT")
label:SetPoint("LEFT", image, "RIGHT", 5, 0)
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
highlight:SetAllPoints(frame)
@@ -140,11 +202,28 @@ local function Constructor()
highlight:SetVertexColor(0.2, 0.4, 0.8, 0.2)
highlight:SetBlendMode("ADD")
local expandedHighlight = frame:CreateTexture(nil, "BACKGROUND")
expandedHighlight:SetPoint("TOPLEFT", frame, -2, 0)
expandedHighlight:SetPoint("BOTTOMRIGHT", frame, 0, 0)
expandedHighlight:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_White")
expandedHighlight:SetVertexColor(1, 0.8, 0, 0.1)
expandedHighlight:SetBlendMode("ADD")
local expandedBackground = frame:CreateTexture(nil, "BACKGROUND")
expandedBackground:SetPoint("TOPLEFT", frame, "BOTTOMLEFT", -1, -1)
expandedBackground:SetWidth(128)
expandedBackground:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\Square_AlphaGradient")
expandedBackground:SetVertexColor(1, 0.8, 0, 0.15)
expandedBackground:SetBlendMode("ADD")
local widget = {
label = label,
image = image,
frame = frame,
type = Type
type = Type,
expanded = false,
expandedBackground = expandedBackground,
expandedHighlight = expandedHighlight,
}
for method, func in pairs(methods) do
widget[method] = func
+21 -4
View File
@@ -93,6 +93,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
local order = startorder or 10;
local isCollapsedFunctions;
local positionsForCollapseAnchor = {}
for index, arg in pairs(prototype.args) do
local hidden = nil;
if(arg.collapse and isCollapsedFunctions[arg.collapse] and type(arg.enable) == "function") then
@@ -104,6 +105,7 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
hidden = function() return not arg.enable(trigger) end;
elseif(arg.collapse and isCollapsedFunctions[arg.collapse]) then
hidden = isCollapsedFunctions[arg.collapse]
positionsForCollapseAnchor[arg.collapse] = order
end
local name = arg.name;
local validate = arg.validate;
@@ -117,16 +119,19 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
order = order,
image = function()
local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true)
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24,
imageWidth = 15,
imageHeight = 15,
func = function(info, button, secondCall)
if not secondCall then
local collapsed = WeakAuras.IsCollapsed("trigger", name, "", true)
WeakAuras.SetCollapsed("trigger", name, "", not collapsed)
end
end,
arg = {
expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name
}
}
order = order + 1;
@@ -905,7 +910,19 @@ function WeakAuras.ConstructOptions(prototype, data, startorder, triggernum, tri
end
end
WeakAuras.option = options;
for name, order in pairs(positionsForCollapseAnchor) do
options[name .. "anchor"] = {
type = "description",
name = "",
control = "WeakAurasExpandAnchor",
order = order + 0.5,
arg = {
expanderName = triggernum .. "#" .. tostring(prototype) .. "#" .. name
},
hidden = isCollapsedFunctions[name]
}
end
return options;
end
+16 -3
View File
@@ -94,14 +94,17 @@ local function createOptions(id, data)
order = 7,
image = function()
local collapsed = WeakAuras.IsCollapsed("icon", "icon", "iconextra", true);
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24,
imageWidth = 15,
imageHeight = 15,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("icon", "icon", "iconextra", true);
WeakAuras.SetCollapsed("icon", "icon", "iconextra", not collapsed);
end,
arg = {
expanderName = "icon"
}
},
iconExtra_space1 = {
type = "description",
@@ -159,6 +162,16 @@ local function createOptions(id, data)
order = 7.07,
hidden = hiddenIconExtra,
},
iconExtraAnchor = {
type = "description",
name = "",
order = 8,
hidden = hiddenIconExtra,
control = "WeakAurasExpandAnchor",
arg = {
expanderName = "icon"
}
},
cooldownHeader = {
type = "header",
order = 11,
+17 -3
View File
@@ -110,10 +110,13 @@ local function createOptions(id, data)
end,
image = function()
local collapsed = WeakAuras.IsCollapsed("text", "text", "fontflags", true)
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24
imageWidth = 15,
imageHeight = 15,
arg = {
expanderName = "text"
}
},
text_font_space = {
@@ -232,6 +235,17 @@ local function createOptions(id, data)
hidden = function() return hiddenFontExtra() or data.automaticWidth ~= "Fixed" end
},
fontExtraAnchor = {
type = "description",
name = "",
order = 50,
hidden = hiddenFontExtra,
control = "WeakAurasExpandAnchor",
arg = {
expanderName = "text"
}
},
endHeader = {
type = "header",
order = 100,
+17 -3
View File
@@ -108,14 +108,17 @@ local function createOptions(parentData, data, index, subIndex)
order = 4,
image = function()
local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24,
imageWidth = 15,
imageHeight = 15,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("glow", "glow", "glowextra" .. index, true);
WeakAuras.SetCollapsed("glow", "glow", "glowextra" .. index, not collapsed);
end,
arg = {
expanderName = "glow" .. index .. "#" .. subIndex
}
},
glow_space1 = {
type = "description",
@@ -245,6 +248,17 @@ local function createOptions(parentData, data, index, subIndex)
name = L["Border"],
order = 19,
hidden = function() return hiddenGlowExtra() or data.glowType ~= "Pixel" end,
},
glow_anchor = {
type = "description",
name = "",
order = 20,
hidden = hiddenGlowExtra,
control = "WeakAurasExpandAnchor",
arg = {
expanderName = "glow" .. index .. "#" .. subIndex
}
}
}
return options
+35 -7
View File
@@ -135,10 +135,13 @@ local function createOptions(parentData, data, index, subIndex)
end,
image = function()
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "fontflags" .. index, true)
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24
imageWidth = 15,
imageHeight = 15,
arg = {
expanderName = "subtext" .. index .. "#" .. subIndex
}
},
text_font_space = {
@@ -256,6 +259,17 @@ local function createOptions(parentData, data, index, subIndex)
values = WeakAuras.text_word_wrap,
hidden = function() return hiddenFontExtra() or data.text_automaticWidth ~= "Fixed" end
},
text_anchor = {
type = "description",
name = "",
order = 55,
hidden = hiddenFontExtra,
control = "WeakAurasExpandAnchor",
arg = {
expanderName = "subtext" .. index .. "#" .. subIndex
}
}
}
-- Note: Anchor Options need to be generalized once there are multiple sub regions
@@ -306,14 +320,17 @@ local function createOptions(parentData, data, index, subIndex)
order = 60,
image = function()
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24,
imageWidth = 15,
imageHeight = 15,
func = function(info, button)
local collapsed = WeakAuras.IsCollapsed("subregion", "text_anchors", tostring(index), true)
WeakAuras.SetCollapsed("subregion", "text_anchors", tostring(index), not collapsed)
end
end,
arg = {
expanderName = "subtext_anchor" .. index .. "#" .. subIndex
}
}
@@ -380,6 +397,17 @@ local function createOptions(parentData, data, index, subIndex)
hidden = hiddenFunction
}
options.text_anchor_anchor = {
type = "description",
name = "",
order = 61,
hidden = hiddenFontExtra,
control = "WeakAurasExpandAnchor",
arg = {
expanderName = "subtext_anchor" .. index .. "#" .. subIndex
}
}
local function hideCustomTextOption()
if not parentData.subRegions then
return true
+17 -3
View File
@@ -108,10 +108,13 @@ local function createOptions(parentData, data, index, subIndex)
end,
image = function()
local collapsed = WeakAuras.IsCollapsed("subtext", "subtext", "tickextras" .. index, true)
return collapsed and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return collapsed and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24
imageWidth = 15,
imageHeight = 15,
arg = {
expanderName = "tick" .. index .. "#" .. subIndex
}
},
automatic_length = {
type = "toggle",
@@ -209,6 +212,17 @@ local function createOptions(parentData, data, index, subIndex)
softMax = 200,
hidden = hiddentickextras,
},
tick_anchor = {
type = "description",
name = "",
order = 18,
hidden = hiddentickextras,
control = "WeakAurasExpandAnchor",
arg = {
expanderName = "tick" .. index .. "#" .. subIndex
}
}
}
return options
end
+23 -3
View File
@@ -32,6 +32,9 @@ local spellCache = WeakAuras.spellCache;
local savedVars = {};
WeakAuras.savedVars = savedVars;
WeakAuras.expanderAnchors = {}
WeakAuras.expanderButtons = {}
local tempGroup = {
id = {"tempGroup"},
regionType = "group",
@@ -1617,10 +1620,13 @@ function WeakAuras.AddTextFormatOption(input, withHeader, get, addOption, hidden
setHidden(not hidden())
end,
image = function()
return hidden() and "Interface\\AddOns\\WeakAuras\\Media\\Textures\\edit" or "Interface\\AddOns\\WeakAuras\\Media\\Textures\\editdown"
return hidden() and "collapsed" or "expanded"
end,
imageWidth = 24,
imageHeight = 24
imageWidth = 15,
imageHeight = 15,
arg = {
expanderName = tostring(addOption)
}
}
addOption("header", headerOption)
else
@@ -1661,6 +1667,20 @@ function WeakAuras.AddTextFormatOption(input, withHeader, get, addOption, hidden
end
end)
if withHeader then
addOption("header_anchor",
{
type = "description",
name = "",
control = "WeakAurasExpandAnchor",
arg = {
expanderName = tostring(addOption)
}
}
)
end
if not next(seenSymbols) and withHeader then
headerOption.hidden = true
end
+1
View File
@@ -85,3 +85,4 @@ AceGUI-Widgets\AceGUIWidget-WeakAurasSnippetButton.lua
AceGUI-Widgets\AceGUIContainer-WeakAurasTreeGroup.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasSnippetButton.lua
AceGUI-Widgets\AceGUIContainer-WeakAurasInlineGroup.lua
AceGUI-Widgets\AceGUIWidget-WeakAurasExpandAnchor.lua