Fix dynamic group icons scaling issue, ensure class & spec load on login, reworked queued actions

dynamic group icons used incorrectly parent scale, even without set
This commit is contained in:
NoM0Re
2025-02-25 21:16:08 +01:00
parent 7c7869494e
commit 2157fbc553
5 changed files with 18 additions and 68 deletions
+1 -1
View File
@@ -112,7 +112,7 @@ local function UnitExistsFixed(unit)
if #unit > 9 and unit:sub(1, 9) == "nameplate" then
return nameplateExists[unit] or false
end
return UnitExists(unit) or UnitGUID(unit) or false
return (UnitExists(unit) and UnitGUID(unit)) or false
end
local function UnitIsVisibleFixed(unit)
-55
View File
@@ -3690,61 +3690,6 @@ function WeakAuras.RegisterItemCountWatch()
end
end
-- Queued Action
do
local GetActionInfo, GetMacroSpell, GetSpellLink = GetActionInfo, GetMacroSpell, GetSpellLink
local queuedActionFrame = nil
local buttonIDList = {}
local spellIDList = {}
local function GetActionSpellID(slot)
local actionType, id, _, spellId = GetActionInfo(slot)
if actionType == "spell" then
return spellId
elseif actionType == "macro" then
local name, rank = GetMacroSpell(id)
if name then
local spellLink = GetSpellLink(name, rank or "")
if spellLink then
return tonumber(spellLink:match("spell:(%d+)"))
end
end
end
end
function WeakAuras.WatchQueuedAction()
if not(queuedActionFrame) then
queuedActionFrame = CreateFrame("Frame");
Private.frames["Queued Action Frame"] = queuedActionFrame
for slotID = 1, 120 do
local spellID = GetActionSpellID(slotID)
if spellID then
buttonIDList[slotID] = spellID
spellIDList[spellID] = slotID
end
end
end
queuedActionFrame:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
queuedActionFrame:SetScript("OnEvent", function(_, _, slotID)
Private.StartProfileSystem("generictrigger queued action");
local spellID = GetActionSpellID(slotID)
if spellID then
buttonIDList[slotID] = spellID
spellIDList[spellID] = slotID
elseif buttonIDList[slotID] then
spellIDList[buttonIDList[slotID]] = nil
buttonIDList[slotID] = nil
end
Private.StopProfileSystem("generictrigger queued action");
end)
end
function WeakAuras.FindSpellActionButtons(spellID)
return spellIDList[spellID]
end
end
-- LibSpecWrapper
-- We always register, because it's probably not that often called, and ScanEvents checks
-- early if anyone wants the event
+12 -9
View File
@@ -1038,7 +1038,7 @@ Private.load_prototype = {
type = "multiselect",
values = "spec_types_all",
test = "WeakAuras.CheckClassSpec(class, %s)",
events = {"UNIT_SPEC_CHANGED_player"},
events = {"UNIT_SPEC_CHANGED_player", "WA_DELAYED_PLAYER_ENTERING_WORLD"},
},
{
name = "talent",
@@ -4841,7 +4841,7 @@ Private.event_prototypes = {
["Class/Spec"] = {
type = "unit",
events = {},
internal_events = { "UNIT_SPEC_CHANGED_player" },
internal_events = {"UNIT_SPEC_CHANGED_player", "WA_DELAYED_PLAYER_ENTERING_WORLD"},
name = L["Class and Specialization"],
init = function(trigger)
local class = select(2, UnitClass("player")) or "UNKNOWN"
@@ -7718,15 +7718,18 @@ Private.event_prototypes = {
"ACTIONBAR_PAGE_CHANGED"
},
name = L["Queued Action"],
loadFunc = function()
WeakAuras.WatchQueuedAction()
end,
init = function(trigger)
trigger.spellName = trigger.spellName or 0
local spellName
if trigger.use_exact_spellName then
spellName = trigger.spellName
else
spellName = type(trigger.spellName) == "number" and GetSpellInfo(trigger.spellName) or trigger.spellName
end
local ret = [=[
local button = WeakAuras.FindSpellActionButtons(%d)
local spellname = %q
]=]
return ret:format(trigger.spellName)
return ret:format(spellName)
end,
args = {
{
@@ -7735,11 +7738,11 @@ Private.event_prototypes = {
display = L["Spell"],
type = "spell",
test = "true",
forceExactOption = true,
showExactOption = true,
},
{
hidden = true,
test = "button and IsCurrentAction(button)";
test = "spellname and IsCurrentSpell(spellname)";
},
},
iconFunc = function(trigger)
+4 -2
View File
@@ -97,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
@@ -1391,9 +1391,11 @@ local function modify(parent, region, data)
end
if parent and parent.IsObjectType and parent:IsObjectType("Frame") then
controlPoint:SetParent(parent)
controlPoint:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1)
end
else
controlPoint:SetParent(self)
controlPoint:SetScale(1)
end
local childData = controlPoint.regionData.data
@@ -1536,7 +1538,7 @@ local function modify(parent, region, data)
-- if self.dynamicAnchor then self:UpdateBorder(); return end
Private.StartProfileSystem("dynamicgroup")
Private.StartProfileAura(data.id)
local numVisible, minX, maxX, maxY, minY = 0
local numVisible, minX, maxX, maxY, minY = 0, nil, nil, nil, nil
for active, regionData in ipairs(self.sortedChildren) do
if regionData.shown then
numVisible = numVisible + 1
+1 -1
View File
@@ -703,7 +703,7 @@ function Private.regionPrototype.create(region)
region.RunCode = RunCode;
region.GlowExternal = GlowExternal;
--region.ReAnchor = UpdatePosition; https://github.com/WeakAuras/WeakAuras2/commit/7859d5e
region.ReAnchor = UpdatePosition;
region.SetAnchor = SetAnchor;
region.SetOffset = SetOffset;
region.SetXOffset = SetXOffset;