From 979f9e28e0ad09bdc37fa04aecaba504f3137b42 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 3 Nov 2024 10:49:45 +0100 Subject: [PATCH] nameplates: only change parent sizing when required --- modules/nameplates.lua | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/nameplates.lua b/modules/nameplates.lua index cb103ec7..6290b45b 100644 --- a/modules/nameplates.lua +++ b/modules/nameplates.lua @@ -1054,13 +1054,22 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function () local hookOnUpdate = nameplates.OnUpdate nameplates.OnUpdate = function(self) if C.nameplates["overlap"] == "1" then - -- set parent to 1 pixel to have them overlap each other - this:SetWidth(1) - this:SetHeight(1) + if this:GetWidth() > 1 then + -- set parent to 1 pixel to have them overlap each other + this:SetWidth(1) + this:SetHeight(1) + end else - -- align parent plate to the actual size - this:SetWidth(this.nameplate:GetWidth() * UIParent:GetScale()) - this:SetHeight(this.nameplate:GetHeight() * UIParent:GetScale()) + if not this.nameplate.dwidth then + -- cache initial sizing value for comparison + this.nameplate.dwidth = floor(this.nameplate:GetWidth() * UIParent:GetScale()) + end + + if floor(this:GetWidth()) ~= this.nameplate.dwidth then + -- align parent plate to the actual size + this:SetWidth(this.nameplate:GetWidth() * UIParent:GetScale()) + this:SetHeight(this.nameplate:GetHeight() * UIParent:GetScale()) + end end -- disable click events while spell is targeting