Skip to content

Commit 30225c2

Browse files
author
mergetest
committed
Fix defensive factory row spacing and z-order
Two in-game bugs on 12.1, root-caused via investigation: - Spacing: layoutRow double-scaled the icon-size term (correct for the buff row's legacy math, wrong for defensives, which the legacy path stepped by unscaled size). Added a preScaledStep layout flag; the defensive row opts into the legacy unscaled-size stride. Buff row math unchanged. - Z-order: the factory container's anchor frame had no frame level, so the row drew under the health bar and name text. Create now sets it from a frameLevelOffset (buffs +40, defensives +51 = legacy contentOverlay+26 parity, honoring defensiveIconFrameLevel), re-applied on each layout-version bump so runtime changes and Rebuilds keep it. Raising the anchor raises the whole native subtree. The Defensive Icon frame-level setting is un-blocked, since the factory now honors it. Known limitation (deferred): slider drag-previews don't reach the factory container, so defensive/buff settings apply on drag-release, not live mid-drag. The duplicate-aura bug (one aura per matching filter) is parked for PTR-4.
1 parent 561f698 commit 30225c2

3 files changed

Lines changed: 33 additions & 11 deletions

File tree

Features/Auras.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,6 +2563,8 @@ function DF:DriveBuffFactory(frame, db)
25632563
unit = frame.unit,
25642564
filterList = BuildDirectBuffFilters(db),
25652565
})
2566+
-- Re-apply the z-order level (buffs default to +40 = legacy parity). Not part of the sig.
2567+
h:GetFrame():SetFrameLevel(math.max(0, frame:GetFrameLevel() + (cfg.frameLevelOffset or 40)))
25662568
local sig = buffFactorySig(cfg)
25672569
if frame.buffFactorySig ~= sig then
25682570
frame.buffFactorySig = sig
@@ -2631,6 +2633,11 @@ function DF:BuildDefensiveRowConfig(db, unit)
26312633
max = db.defensiveBarMax or 4,
26322634
enabled = true,
26332635
tooltips = not db.defensiveIconDisableMouse,
2636+
-- Z-order: match the legacy defensive level — contentOverlay+26 = frame+51 when auto
2637+
-- (defensiveIconFrameLevel 0), else the user's own offset. Applied to the container's
2638+
-- anchor frame in AuraContainer:Create + on each layout-version re-apply.
2639+
frameLevelOffset = (db.defensiveIconFrameLevel and db.defensiveIconFrameLevel ~= 0)
2640+
and db.defensiveIconFrameLevel or 51,
26342641
layout = {
26352642
size = db.defensiveIconSize or 24,
26362643
scale = db.defensiveIconScale or 1,
@@ -2641,6 +2648,7 @@ function DF:BuildDefensiveRowConfig(db, unit)
26412648
wrap = db.defensiveBarWrap or 5,
26422649
offsetX = db.defensiveIconX or 0,
26432650
offsetY = db.defensiveIconY or 0,
2651+
preScaledStep = false, -- legacy defensive spacing (unscaled size term; no double-scale)
26442652
},
26452653
style = {
26462654
icon = { show = true, zoom = true, inset = 0 },
@@ -2697,6 +2705,9 @@ function DF:DriveDefensiveFactory(frame, db)
26972705
if frame.dfDefFactoryVersion ~= ver then
26982706
frame.dfDefFactoryVersion = ver
26992707
local cfg = DF:BuildDefensiveRowConfig(db, frame.unit)
2708+
-- Re-apply the z-order level (honors runtime defensiveIconFrameLevel changes; survives
2709+
-- Rebuild since the new container inherits relative to h.frame). Not part of the sig.
2710+
h:GetFrame():SetFrameLevel(math.max(0, frame:GetFrameLevel() + (cfg.frameLevelOffset or 40)))
27002711
local sig = buffFactorySig(cfg)
27012712
if frame.defensiveFactorySig ~= sig then
27022713
frame.defensiveFactorySig = sig

Frames/AuraContainer.lua

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,9 +578,18 @@ local function layoutRow(handle)
578578

579579
-- Step matches the legacy Direct-row math: the icon-size term is pre-scaled and each
580580
-- button is SetScale(scale)'d, so the icon, the step, and the button's children (fonts,
581-
-- border, cooldown) all render at `scale` — pixel-matching DF's rows. scale=1 is a no-op.
582-
local stepX = sx * scale + spX
583-
local stepY = sy * scale + spY
581+
-- border, cooldown) all render at `scale` — pixel-matching DF's buff rows. scale=1 is a no-op.
582+
-- preScaledStep=false (defensive row) uses the legacy DEFENSIVE stride: the icon-size term
583+
-- is UNSCALED, so — offsets living in the button's scaled space — the rendered stride is
584+
-- (size+spacing)*scale and the gap is spacing*scale (no double-scale of the size term).
585+
local stepX, stepY
586+
if L.preScaledStep == false then
587+
stepX = sx + spX
588+
stepY = sy + spY
589+
else
590+
stepX = sx * scale + spX
591+
stepY = sy * scale + spY
592+
end
584593
for i, b in ipairs(handle.buttons) do
585594
local idx = i - 1
586595
local col = idx % wrap
@@ -1087,6 +1096,11 @@ function AuraContainer:Create(parent, config)
10871096
-- Both modes: h.frame occupies the unit-frame rect (row layout anchors are relative
10881097
-- to it; overlay covers it). To reposition: h:ClearAllPoints() then h:SetPoint(...).
10891098
h.frame:SetAllPoints(parent)
1099+
-- Z-order: legacy renders host aura icons ABOVE contentOverlay (parent+25, name/health
1100+
-- text). Raising h.frame raises the whole subtree — the native container + AuraButtons +
1101+
-- their holders are all descendants with relative levels (Blizzard sets no fixed levels).
1102+
-- Default +40 = legacy buff-icon level; the defensive row passes +51 (= contentOverlay+26).
1103+
h.frame:SetFrameLevel(math.max(0, parent:GetFrameLevel() + (cfg.frameLevelOffset or 40)))
10901104

10911105
if InCombatLockdown() then
10921106
-- Can't safely stand up secure container state in combat; build on regen.

Options/Options.lua

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6335,10 +6335,10 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
63356335
local pageDefensiveIcon = CreateSubTab("auras", "auras_defensiveicon", L["Defensive Icon"])
63366336
-- 12.1: defensive icons now render through DF.AuraContainer (native BIG_DEFENSIVE /
63376337
-- EXTERNAL_DEFENSIVE filters); the legacy path stays as a secret-hardened fallback, so
6338-
-- the page is usable — no whole-page banner. Only settings the factory can't honor are
6339-
-- blocked (frame level, below). Left as known gaps (not cleanly addressable): border
6340-
-- animation (inlined in the shared border helper) and CENTER growth (a dropdown option
6341-
-- that falls back to RIGHT under the factory).
6338+
-- the page is usable — no whole-page banner, and nothing is blocked (frame level IS
6339+
-- honored, via the container's frameLevelOffset). Known gaps the factory doesn't
6340+
-- reproduce yet (not cleanly addressable, left as-is): border animation (inlined in the
6341+
-- shared border helper) and CENTER growth (a dropdown option that falls back to RIGHT).
63426342
BuildPage(pageDefensiveIcon, function(self, db, Add, AddSpace, AddSyncPoint)
63436343
-- Copy button at top
63446344
Add(CreateCopyButton(self.child, {"defensiveIcon"}, L["Defensive Icon"], "auras_defensiveicon"), 25, 2)
@@ -6382,12 +6382,9 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
63826382
if DF.UpdateAllDefensiveBars then DF:UpdateAllDefensiveBars() end
63836383
end, function() DF:LightweightUpdateDefensiveIcons() end, true), 55)
63846384

6385-
local defFrameLevelSlider = appearanceGroup:AddWidget(GUI:CreateSlider(self.child, L["Frame Level"], 0, 100, 1, db, "defensiveIconFrameLevel", function()
6385+
appearanceGroup:AddWidget(GUI:CreateSlider(self.child, L["Frame Level"], 0, 100, 1, db, "defensiveIconFrameLevel", function()
63866386
if DF.UpdateAllDefensiveBars then DF:UpdateAllDefensiveBars() end
63876387
end, function() DF:LightweightUpdateFrameLevel("defensive") end, true), 55)
6388-
-- The factory manages the container's own frame level, so this can't apply while
6389-
-- the factory owns the defensive row (12.1).
6390-
GUI:BlockControl12_1(defFrameLevelSlider, "roadmap", { id = "defensive:framelevel", page = L["Defensive Icon"], when = function(d) return DF:FactoryOwnsDefensiveRow(d) end })
63916388

63926389
appearanceGroup:AddWidget(GUI:CreateLabel(self.child, L["0=Auto, Higher=On top of more elements"], 230), 25)
63936390
Add(appearanceGroup, nil, 2)

0 commit comments

Comments
 (0)