From 9e51b319d95f3fc3033381c28be14a0168df0031 Mon Sep 17 00:00:00 2001 From: shagu Date: Thu, 12 Jun 2025 15:08:58 +0200 Subject: [PATCH] unitframes: move unit texts to separate frame --- api/unitframes.lua | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/api/unitframes.lua b/api/unitframes.lua index 9dc4c677..2eb073d6 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -601,7 +601,6 @@ function pfUI.uf:UpdateConfig() f.hpLeftText:SetFontObject(GameFontWhite) f.hpLeftText:SetFont(fontname, fontsize, fontstyle) f.hpLeftText:SetJustifyH("LEFT") - f.hpLeftText:SetParent(f.hp.bar) f.hpLeftText:ClearAllPoints() f.hpLeftText:SetPoint("TOPLEFT",f.hp.bar, "TOPLEFT", 2*(default_border + f.config.txthpleftoffx), 1 + tonumber(f.config.txthpleftoffy)) f.hpLeftText:SetPoint("BOTTOMRIGHT",f.hp.bar, "BOTTOMRIGHT", -2*(default_border + f.config.txthpleftoffx), f.config.txthpleftoffy) @@ -609,7 +608,6 @@ function pfUI.uf:UpdateConfig() f.hpRightText:SetFontObject(GameFontWhite) f.hpRightText:SetFont(fontname, fontsize, fontstyle) f.hpRightText:SetJustifyH("RIGHT") - f.hpRightText:SetParent(f.hp.bar) f.hpRightText:ClearAllPoints() f.hpRightText:SetPoint("TOPLEFT",f.hp.bar, "TOPLEFT", 2*(default_border + f.config.txthprightoffx), 1 + tonumber(f.config.txthprightoffy)) f.hpRightText:SetPoint("BOTTOMRIGHT",f.hp.bar, "BOTTOMRIGHT", -2*(default_border + f.config.txthprightoffx), f.config.txthprightoffy) @@ -617,7 +615,6 @@ function pfUI.uf:UpdateConfig() f.hpCenterText:SetFontObject(GameFontWhite) f.hpCenterText:SetFont(fontname, fontsize, fontstyle) f.hpCenterText:SetJustifyH("CENTER") - f.hpCenterText:SetParent(f.hp.bar) f.hpCenterText:ClearAllPoints() f.hpCenterText:SetPoint("TOPLEFT",f.hp.bar, "TOPLEFT", f.config.txthpcenteroffx, 1 + tonumber(f.config.txthpcenteroffy)) f.hpCenterText:SetPoint("BOTTOMRIGHT",f.hp.bar, "BOTTOMRIGHT", f.config.txthpcenteroffx, f.config.txthpcenteroffy) @@ -625,7 +622,6 @@ function pfUI.uf:UpdateConfig() f.powerLeftText:SetFontObject(GameFontWhite) f.powerLeftText:SetFont(fontname, fontsize, fontstyle) f.powerLeftText:SetJustifyH("LEFT") - f.powerLeftText:SetParent(f.power.bar) f.powerLeftText:ClearAllPoints() f.powerLeftText:SetPoint("TOPLEFT",f.power.bar, "TOPLEFT", 2*(default_border + f.config.txtpowerleftoffx), 1 + tonumber(f.config.txtpowerleftoffy)) f.powerLeftText:SetPoint("BOTTOMRIGHT",f.power.bar, "BOTTOMRIGHT", -2*(default_border + f.config.txtpowerleftoffx), f.config.txtpowerleftoffy) @@ -633,7 +629,6 @@ function pfUI.uf:UpdateConfig() f.powerRightText:SetFontObject(GameFontWhite) f.powerRightText:SetFont(fontname, fontsize, fontstyle) f.powerRightText:SetJustifyH("RIGHT") - f.powerRightText:SetParent(f.power.bar) f.powerRightText:ClearAllPoints() f.powerRightText:SetPoint("TOPLEFT",f.power.bar, "TOPLEFT", 2*(default_border + f.config.txtpowerrightoffx), 1 + tonumber(f.config.txtpowerrightoffy)) f.powerRightText:SetPoint("BOTTOMRIGHT",f.power.bar, "BOTTOMRIGHT", -2*(default_border + f.config.txtpowerrightoffx), f.config.txtpowerrightoffy) @@ -641,7 +636,6 @@ function pfUI.uf:UpdateConfig() f.powerCenterText:SetFontObject(GameFontWhite) f.powerCenterText:SetFont(fontname, fontsize, fontstyle) f.powerCenterText:SetJustifyH("CENTER") - f.powerCenterText:SetParent(f.power.bar) f.powerCenterText:ClearAllPoints() f.powerCenterText:SetPoint("TOPLEFT",f.power.bar, "TOPLEFT", f.config.txtpowercenteroffx, 1 + tonumber(f.config.txtpowercenteroffy)) f.powerCenterText:SetPoint("BOTTOMRIGHT",f.power.bar, "BOTTOMRIGHT", f.config.txtpowercenteroffx, f.config.txtpowercenteroffy) @@ -1263,12 +1257,16 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) f.combat.tex = f.combat:CreateTexture(nil, "OVERLAY") f.combat.tex:SetAllPoints() - f.hpLeftText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") - f.hpRightText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") - f.hpCenterText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") - f.powerLeftText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") - f.powerRightText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") - f.powerCenterText = f:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") + f.texts = CreateFrame("Frame", nil, f) + f.texts:SetFrameLevel(16) + f.texts:SetAllPoints() + + f.hpLeftText = f.texts:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") + f.hpRightText = f.texts:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") + f.hpCenterText = f.texts:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") + f.powerLeftText = f.texts:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") + f.powerRightText = f.texts:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") + f.powerCenterText = f.texts:CreateFontString("Status", "OVERLAY", "GameFontNormalSmall") f.incHeal = CreateFrame("Frame", nil, f.hp) f.incHeal.texture = f.incHeal:CreateTexture(nil, "BACKGROUND")