Skip to content

Commit b2b5a7a

Browse files
committed
Text Designer: remove dead Frame Level/Strata controls, fix class-color override-to-off, first-pass anchor fallback, disabled anchor targets, name length 0=off, and Max HP Reduction scaling
1 parent 9752a87 commit b2b5a7a

5 files changed

Lines changed: 55 additions & 45 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
* (Nicknames) **Northern Sky Raid Tools compatibility** — when NSRT is also set to put nicknames on DandersFrames frames, a one-time prompt lets you choose which addon decides the names shown on your frames (changeable later under **General → Nicknames → Name precedence**), so the two no longer silently fight. (by Maelareth)
4444
* (Aura Designer) Alert sounds now play on the **Master** channel by default, so they stay audible even with Sound Effects or Music muted. A new **Channel** dropdown next to the Sound Alerts toggle lets you pick a different channel, and the per-alert volume slider now works on whichever channel is selected. (by Krathe)
4545
* Ready for **patch 12.0.7** — the addon-compartment tooltip and the frame mover's Ready Check action keep working when the new patch ships, with no change on the current version. (by Krathe)
46+
* (Text Designer) Removed the per-element **Frame Level** and **Frame Strata** controls — they had no real effect. Text layering above bars and below icons is handled automatically.
4647

4748
### Bug Fixes
4849

@@ -72,6 +73,10 @@
7273
* (Text Designer) Text element edits now update **test-mode frames** live, not just real units. (by Krathe)
7374
* (Designers) The Aura/Text Designer **preview now rebuilds to the frame size of the auto layout being edited**, instead of staying stuck at a previous layout's dimensions. (by Krathe)
7475
* (Designers) Text Designer edits (and Aura Designer changes) no longer **stop updating on test-mode frames after switching between auto layouts** — applying a layout's overrides kept the designer's table/preview bindings valid instead of orphaning them. (by Krathe)
76+
* (Text Designer) **Use Class Color** can now be turned off on a single element when your global text default has it on.
77+
* (Text Designer) Text anchored to another element no longer **jumps position right after a reload**, and re-anchors to the frame while the element it's anchored to is disabled.
78+
* (Text Designer) The name **Max Length** slider can now be set to **0 to turn truncation off**, matching the old name text setting it replaced.
79+
* (Text Designer) Fixed the **Max HP Reduction** text showing the wrong percentage for small reductions.
7580
* (Frames) Missing textures now fall back to a bundled default instead of rendering black. If a profile you import references a custom or shared-media texture you don't have installed (or the addon that provided it was removed), the affected health bar, background or other bar now uses DandersFrames' default texture and shows a one-time notice — rather than a black/blank bar. (Requires WoW 12.0.7; on earlier versions there is no change.) (by Krathe)
7681
* (Aura Designer) The expiring **"Pulsate"** option now works for the replace-mode health-bar highlight (it previously stayed solid in replace mode). (by Krathe)
7782
* (Text Designer) Fix blank text on profiles that weren't active at login — switching to an older profile now converts its built-in text correctly.

Locales/enUS.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,6 @@ L["Incoming Heal"] = true
919919
L["Incoming Heal From Me Only"] = true
920920
L["Indicators"] = true
921921
L["Info (All)"] = true
922-
L["Inherit"] = true
923922
L["Insanity"] = true
924923
L["Inset"] = true
925924
L["Inside (Bottom)"] = true
@@ -960,7 +959,6 @@ L["Left of Party"] = true
960959
L["Left of Raid"] = true
961960
L["Left to Right"] = true
962961
L["Let Masque Control Aura Borders"] = true
963-
L["Length"] = true
964962
L["Line"] = true
965963
L["Loading..."] = true
966964
L["Lock"] = true

TextDesigner/Options.lua

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ local function BuildContentSection(GUI, parent, elem, tdDB, state, page, card, y
330330
local function lenCB()
331331
if DF.TextDesigner.Preview then DF.TextDesigner.Preview:RefreshAll() end
332332
end
333-
local lenSlider = GUI:CreateSlider(parent, L["Length"], 1, 30, 1, elem, "nameLength", lenCB, lenCB)
333+
local lenSlider = GUI:CreateSlider(parent, L["Max Length (0=off)"], 0, 30, 1, elem, "nameLength", lenCB, lenCB)
334334
lenSlider:SetPoint("TOPLEFT", parent, "TOPLEFT", 14, y)
335335
y = y - FIELD_ROW_HEIGHT
336336

@@ -877,8 +877,6 @@ local function BuildPositionSection(GUI, parent, elem, tdDB, card, yStart)
877877
elem.anchor = elem.anchor or "CENTER"
878878
elem.offsetX = elem.offsetX or 0
879879
elem.offsetY = elem.offsetY or 0
880-
elem.frameLevel = elem.frameLevel or 25
881-
elem.frameStrata = elem.frameStrata or "INHERIT"
882880
elem.anchorTo = elem.anchorTo or "FRAME"
883881

884882
-- Shared callback: every position-related widget needs to refresh the
@@ -912,26 +910,6 @@ local function BuildPositionSection(GUI, parent, elem, tdDB, card, yStart)
912910
ySlider:SetPoint("TOPLEFT", parent, "TOPLEFT", 14, y)
913911
y = y - FIELD_ROW_HEIGHT
914912

915-
local function lvlCB()
916-
if DF.TextDesigner.Preview then DF.TextDesigner.Preview:RefreshAll() end
917-
end
918-
local lvlSlider = GUI:CreateSlider(parent, L["Frame Level"], 1, 200, 1, elem, "frameLevel", lvlCB, lvlCB)
919-
lvlSlider:SetPoint("TOPLEFT", parent, "TOPLEFT", 14, y)
920-
y = y - FIELD_ROW_HEIGHT
921-
922-
local strataOpts = {
923-
INHERIT = L["Inherit"],
924-
LOW = "LOW",
925-
MEDIUM = "MEDIUM",
926-
HIGH = "HIGH",
927-
DIALOG = "DIALOG",
928-
}
929-
local strataDrop = GUI:CreateDropdown(parent, L["Frame Strata"], strataOpts, elem, "frameStrata", function()
930-
if DF.TextDesigner.Preview then DF.TextDesigner.Preview:RefreshAll() end
931-
end)
932-
strataDrop:SetPoint("TOPLEFT", parent, "TOPLEFT", 14, y)
933-
y = y - FIELD_ROW_HEIGHT
934-
935913
-- Anchor To: target element (or the unit frame). Options are computed
936914
-- dynamically and exclude self + transitive descendants to prevent cycles.
937915
local anchorTargets = BuildAnchorTargets(tdDB, elem)

TextDesigner/Render.lua

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ DF.TextDesigner.Render = Render
1414
local function getResolver() return DF.TextDesigner.Resolver end
1515
local function getMS() return DF.TextDesigner.MidnightSafe end
1616

17+
local wipe = wipe
18+
19+
-- Enabled-element id set, rebuilt by UpdateFrame. Module-local and reused
20+
-- (wipe, not {}) because UpdateFrame runs in the unit-event hot path.
21+
local enabledScratch = {}
22+
1723
-- ============================================================
1824
-- HINT CATEGORIES — which content types refresh on which hints
1925
-- ============================================================
@@ -60,12 +66,21 @@ local CONTENT_HINTS = {
6066
local function resolveAppearance(elem, globalDefaults)
6167
globalDefaults = globalDefaults or {}
6268
local overrides = elem.overrides or {}
69+
-- useClassColor is the one boolean field, so the `(override and value) or
70+
-- global` pattern the others use would swallow an override of FALSE (it
71+
-- falls through to the global default). Branch on the override flag instead.
72+
local useClassColor
73+
if overrides.useClassColor then
74+
useClassColor = elem.useClassColor or false
75+
else
76+
useClassColor = globalDefaults.useClassColor or false
77+
end
6378
return {
6479
font = (overrides.font and elem.font) or globalDefaults.font or "DF Roboto SemiBold",
6580
fontSize = (overrides.fontSize and elem.fontSize) or globalDefaults.fontSize or 10,
6681
color = (overrides.color and elem.color) or globalDefaults.color or {r=1, g=1, b=1, a=1},
6782
outline = (overrides.outline and elem.outline) or globalDefaults.outline or "SHADOW;NONE",
68-
useClassColor = (overrides.useClassColor and elem.useClassColor) or globalDefaults.useClassColor or false,
83+
useClassColor = useClassColor,
6984
}
7085
end
7186

@@ -91,11 +106,14 @@ end
91106

92107
-- Returns the frame to anchor to. anchorTo == "FRAME" → parent frame.
93108
-- anchorTo == <element id string> → that element's FontString on the same frame.
94-
local function resolveAnchorTarget(elem, frame, fontStringsById)
109+
-- A disabled target counts as absent: its FontString is hidden with stale
110+
-- geometry, so dependents re-anchor to the frame instead of hanging off it.
111+
local function resolveAnchorTarget(elem, frame, fontStringsById, enabledById)
95112
local target = elem.anchorTo or "FRAME"
96113
if target == "FRAME" then return frame end
97114
local targetId = tonumber(target)
98-
if targetId and fontStringsById and fontStringsById[targetId] then
115+
if targetId and fontStringsById and fontStringsById[targetId]
116+
and (not enabledById or enabledById[targetId]) then
99117
return fontStringsById[targetId]
100118
end
101119
return frame -- fallback
@@ -152,19 +170,14 @@ local function applyAppearance(fs, frame, elem, globalDefaults)
152170
fs._useClassColor = false
153171
fs:SetTextColor(app.color.r, app.color.g, app.color.b, app.color.a or 1)
154172
end
155-
-- Frame strata / level
156-
if elem.frameStrata and elem.frameStrata ~= "INHERIT" then
157-
fs:SetDrawLayer("OVERLAY", 7) -- WoW FontStrings honor draw layer
158-
end
159173
end
160174

161175
-- Applies position to the FontString (separate from appearance so we can
162176
-- update position when anchorTo's target moves).
163-
local function applyPosition(fs, frame, elem, fontStringsById)
177+
local function applyPosition(fs, frame, elem, fontStringsById, enabledById)
164178
fs:ClearAllPoints()
165-
local target = resolveAnchorTarget(elem, frame, fontStringsById)
166-
fs:SetPoint(elem.anchor or "CENTER", target,
167-
(elem.anchorTo and elem.anchorTo ~= "FRAME") and (elem.anchor or "CENTER") or (elem.anchor or "CENTER"),
179+
local target = resolveAnchorTarget(elem, frame, fontStringsById, enabledById)
180+
fs:SetPoint(elem.anchor or "CENTER", target, elem.anchor or "CENTER",
168181
elem.offsetX or 0, elem.offsetY or 0)
169182
end
170183

@@ -174,7 +187,7 @@ end
174187

175188
-- Renders a single elem on a frame. Called per-element from UpdateFrame.
176189
-- source is a DataSource (Live or Mock).
177-
local function updateOne(frame, elem, source, globalDefaults)
190+
local function updateOne(frame, elem, source, globalDefaults, enabledById)
178191
DF:Debug("TD", "updateOne: id=%s type=%s enabled=%s",
179192
tostring(elem.id), tostring(elem.contentType), tostring(elem.enabled))
180193
if not elem.enabled then
@@ -184,7 +197,7 @@ local function updateOne(frame, elem, source, globalDefaults)
184197
end
185198
local fs = acquireFontString(frame, elem)
186199
applyAppearance(fs, frame, elem, globalDefaults)
187-
applyPosition(fs, frame, elem, frame._tdFontStrings)
200+
applyPosition(fs, frame, elem, frame._tdFontStrings, enabledById)
188201
-- Apply class color if requested
189202
if fs._useClassColor then
190203
local token = source:GetClassToken()
@@ -228,10 +241,22 @@ function Render:UpdateFrame(frame, tdDB, source, hint, isPreview)
228241
end
229242
hint = hint or "all"
230243
local globalDefaults = tdDB.globalDefaults
244+
-- Pre-create the FontString for every enabled element before any element is
245+
-- positioned, so one anchored to a later-listed element finds its target on
246+
-- the very first pass (it previously fell back to frame-anchoring for one
247+
-- update, making anchored layouts jump just after a reload). The same sweep
248+
-- records which ids are enabled for resolveAnchorTarget's disabled check.
249+
wipe(enabledScratch)
250+
for _, elem in ipairs(tdDB.elements or {}) do
251+
if elem.enabled then
252+
enabledScratch[elem.id] = true
253+
acquireFontString(frame, elem)
254+
end
255+
end
231256
for _, elem in ipairs(tdDB.elements or {}) do
232257
local elemHint = CONTENT_HINTS[elem.contentType]
233258
if hint == "all" or elemHint == "all" or elemHint == hint then
234-
updateOne(frame, elem, source, globalDefaults)
259+
updateOne(frame, elem, source, globalDefaults, enabledScratch)
235260
end
236261
end
237262

TextDesigner/Resolver.lua

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,17 @@ end
206206

207207
RESOLVERS.hp_max_reduction = function(elem, source)
208208
if deadHidden(elem, source) then return "" end
209-
local pct = source:GetHPMaxReductionPct() or 0
209+
local pct = source:GetHPMaxReductionPct()
210+
if pct == nil then return "" end
211+
-- Can be secret in combat (ReducedMaxHealth.lua guards the same API call);
212+
-- comparison and arithmetic on a secret throw, so hide like the bar does.
213+
if getMS().IsSecret(pct) then return "" end
210214
if pct == 0 then return "" end
211-
-- API returns 0..1 in some patches and 0..100 in others.
212-
-- Defensive: if value is <= 1, multiply by 100 for display.
213-
local v = pct
214-
if pct <= 1 then v = pct * 100 end
215-
return string.format(elem.hidePercent and "-%.0f" or "-%.0f%%", v)
215+
-- GetUnitTotalModifiedMaxHealthPercent returns a 0..1 fraction — the
216+
-- Reduced Max Health bar feeds it straight into SetValue on a 0..1 bar.
217+
-- Scale unconditionally; the old `pct <= 1` heuristic displayed small
218+
-- reductions as wildly wrong percentages.
219+
return string.format(elem.hidePercent and "-%.0f" or "-%.0f%%", pct * 100)
216220
end
217221

218222
-- ───── Power ─────

0 commit comments

Comments
 (0)