diff --git a/WeakAuras/Compatibility.lua b/WeakAuras/Compatibility.lua index 00cdea8..4754f80 100644 --- a/WeakAuras/Compatibility.lua +++ b/WeakAuras/Compatibility.lua @@ -59,6 +59,17 @@ function tAppendAll(table, addedArray) end end +function MergeTable(t1, t2) + local merged = {} + for k, v in pairs(t1) do + merged[k] = v + end + for k, v in pairs(t2) do + merged[k] = v + end + return merged +end + function IsInGroup() return GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0 end diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 9029315..0f92bc3 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -3114,6 +3114,7 @@ Private.event_prototypes = { else spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; end + if spellName == nil then return {} end local events = { "SPELL_COOLDOWN_CHANGED:" .. spellName, "COOLDOWN_REMAINING_CHECK:" .. spellName, @@ -3412,7 +3413,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -3431,6 +3432,7 @@ Private.event_prototypes = { else spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; end + if spellName == nil then return {} end return { "SPELL_COOLDOWN_READY:" .. spellName } end, name = L["Cooldown Ready Event"], @@ -3498,7 +3500,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -3518,6 +3520,7 @@ Private.event_prototypes = { else spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; end + if spellName == nil then return {} end return { "SPELL_CHARGES_CHANGED:" .. spellName } end, name = L["Charges Changed Event"], @@ -3606,7 +3609,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -3770,7 +3773,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -3973,7 +3976,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -4055,7 +4058,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -4116,7 +4119,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -4189,7 +4192,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -4297,7 +4300,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -4350,6 +4353,7 @@ Private.event_prototypes = { else spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName; end + if spellName == nil then return {} end return { "SPELL_COOLDOWN_CHANGED:" .. spellName } end, force_events = "SPELL_UPDATE_USABLE", @@ -4500,7 +4504,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -5137,7 +5141,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -5656,7 +5660,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -5735,7 +5739,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -6153,7 +6157,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, @@ -7210,7 +7214,7 @@ Private.event_prototypes = { { name = "icon", hidden = true, - init = "icon or 'Interface\\AddOns\\WeakAuras\\Media\\Textures\\icon'", + init = "icon", test = "true", store = true }, diff --git a/WeakAuras/RegionTypes/Text.lua b/WeakAuras/RegionTypes/Text.lua index 8948001..ff48bfc 100644 --- a/WeakAuras/RegionTypes/Text.lua +++ b/WeakAuras/RegionTypes/Text.lua @@ -161,17 +161,22 @@ local function modify(parent, region, data) if text:GetFont() then text:SetText(WeakAuras.ReplaceRaidMarkerSymbols(textStr)); end - end - local width = text:GetWidth(); - local height = text:GetStringHeight(); - if(width ~= region.width or height ~= region.height ) then - region.width = width; - region.height = height; - region:SetWidth(region.width); - region:SetHeight(region.height); - if(data.parent and Private.regions[data.parent].region.PositionChildren) then - Private.regions[data.parent].region:PositionChildren(); + -- If the text changes we need to figure out the text size + -- To unset scaling we need to temporarily detach the text from + -- the region + text:SetParent(UIParent) + local width = text:GetWidth(); + local height = text:GetStringHeight(); + if(width ~= region.width or height ~= region.height ) then + region.width = width + region.height = height + region:SetWidth(region.width); + region:SetHeight(region.height); + if(data.parent and Private.regions[data.parent].region.PositionChildren) then + Private.regions[data.parent].region:PositionChildren(); + end end + text:SetParent(region) end end end diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index efc3523..72dd189 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -3404,12 +3404,16 @@ local wrappedGetOverlayInfo = wrapTriggerSystemFunction("GetOverlayInfo", "table Private.GetAdditionalProperties = function(data) local props = {} - for i = 1, #data.triggers do - local triggerSystem = GetTriggerSystem(data, i); - if (triggerSystem) then - local triggerProps = triggerSystem.GetAdditionalProperties(data, i) - if triggerProps then - props[i] = triggerProps + for child in Private.TraverseLeafsOrAura(data) do + for i, trigger in ipairs(child.triggers) do + local triggerSystem = GetTriggerSystem(child, i) + if triggerSystem then + local triggerProps = triggerSystem.GetAdditionalProperties(child, i) + if triggerProps and props[i] then + MergeTable(props[i], triggerProps) + elseif triggerProps then + props[i] = triggerProps + end end end end @@ -4420,7 +4424,7 @@ local function ReplaceValuePlaceHolders(textStr, region, customFunc, state, form end end - return value or ""; + return type(value) ~= "table" and value or "" end -- States: diff --git a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua index 3ad0dcb..0de081a 100644 --- a/WeakAurasOptions/OptionsFrames/OptionsFrame.lua +++ b/WeakAurasOptions/OptionsFrames/OptionsFrame.lua @@ -946,14 +946,14 @@ function OptionsPrivate.CreateFrame() event = event, time = currentTime, } - if event == "OnEditFocusGained" or not dynamicTextCodesFrame:IsShown() then + if event == "OnEnterPressed" then + dynamicTextCodesFrame:Hide() + elseif event == "OnEditFocusGained" or not dynamicTextCodesFrame:IsShown() then dynamicTextCodesFrame:Show() if OptionsPrivate.currentDynamicTextInput ~= widget then OptionsPrivate.UpdateTextReplacements(dynamicTextCodesFrame, data) end OptionsPrivate.currentDynamicTextInput = widget - elseif event == "OnEnterPressed" then - dynamicTextCodesFrame:Hide() elseif not dynamicTextCodesFrame:IsMouseOver() then -- Prevents hiding when clicking inside the frame dynamicTextCodesFrame:Hide() end