From 3ccd4bef5dbbe6bd897156dafbcff69d642d98d2 Mon Sep 17 00:00:00 2001 From: StefanOyx <110640541+StefanOyx@users.noreply.github.com> Date: Tue, 5 Sep 2023 10:38:39 +0200 Subject: [PATCH 1/2] Quick band-aid fix for always visible 1-2 pixel bar --- .../UnitFrames/Elements/HealPrediction.lua | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua b/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua index c028686..94159f1 100644 --- a/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua +++ b/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua @@ -7,7 +7,7 @@ local StatusBarPrototype = T.StatusBarPrototype function ZUF.HealthClipFrame_HealComm(frame) if frame.HealCommBar then - ZUF:SetAlpha_HealComm(frame.HealCommBar, 1) + ZUF:SetAlpha_HealComm(frame.HealCommBar, 0) --xD changed from 1 to 0 to start it off hidden avoiding bug yet still have it there so it still positions properly end end @@ -303,6 +303,30 @@ function ZUF:UpdateHealComm(_, myIncomingHeal, otherIncomingHeal, absorb, _, has local missingHealth = maxHealth - health local healthPostHeal = health + myIncomingHeal + otherIncomingHeal + -- xD shit code fix to visually hide heal and absorb bar if it is empty avoiding the 1 pixel line they each have by default in that state. Can prob be placed in a better position and fixed in a much better way. + -- This fix is insipred by EvlUI's default function "UpdateFillBar" in their HealComm.lua, they use "if amount == 0 then bar:Hide()" there to do the same thing, calling it on UpdateHealComm. The reason I used SetAlpha instead is + -- that for Zidras UpdateHealComm using :Hide() breaks bar positioning. + + if healthPostHeal == health then + self.myBar:SetAlpha(0) + self.otherBar:SetAlpha(0) + else + self.myBar:SetAlpha(1) + self.otherBar:SetAlpha(1) + end + + if absorb == 0 then + healAbsorbBar:SetAlpha(0) + absorbBar:SetAlpha(0) + overAbsorb:SetAlpha(0) + else + healAbsorbBar:SetAlpha(1) + absorbBar:SetAlpha(1) + overAbsorb:SetAlpha(1) + end + + -- xD end of shit code + -- handle over heal absorbs healAbsorbBar:ClearAllPoints() healAbsorbBar:Point(pred.anchor, frame.Health) From bb51681112328d8b9d5c3882ebbcab38fd6d8da8 Mon Sep 17 00:00:00 2001 From: Zidras <10605951+Zidras@users.noreply.github.com> Date: Fri, 15 Dec 2023 23:00:59 +0000 Subject: [PATCH 2/2] Specify elements to be Alpha'd based on value == 0 Perhaps this method is a bit more robust than previous to avoid assumptions that are not always true --- .../UnitFrames/Elements/HealPrediction.lua | 33 ++++++------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua b/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua index 94159f1..4c12147 100644 --- a/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua +++ b/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua @@ -7,7 +7,7 @@ local StatusBarPrototype = T.StatusBarPrototype function ZUF.HealthClipFrame_HealComm(frame) if frame.HealCommBar then - ZUF:SetAlpha_HealComm(frame.HealCommBar, 0) --xD changed from 1 to 0 to start it off hidden avoiding bug yet still have it there so it still positions properly + ZUF:SetAlpha_HealComm(frame.HealCommBar, 1) end end @@ -272,12 +272,14 @@ function ZUF:Configure_HealComm(frame) end end -function ZUF:UpdateHealComm(_, myIncomingHeal, otherIncomingHeal, absorb, _, hasOverAbsorb, hasOverHealAbsorb, health, maxHealth) +function ZUF:UpdateHealComm(_, myIncomingHeal, otherIncomingHeal, absorb, healAbsorb, hasOverAbsorb, hasOverHealAbsorb, health, maxHealth) local frame = self.frame local db = frame and frame.db and frame.db.healPrediction if not db or not db.absorbStyle or not health then return end local pred = frame.HealCommBar + local myBar = pred.myBar + local otherBar = pred.otherBar local healAbsorbBar = pred.healAbsorbBar local absorbBar = pred.absorbBar local overAbsorb = pred.overAbsorb @@ -303,29 +305,14 @@ function ZUF:UpdateHealComm(_, myIncomingHeal, otherIncomingHeal, absorb, _, has local missingHealth = maxHealth - health local healthPostHeal = health + myIncomingHeal + otherIncomingHeal - -- xD shit code fix to visually hide heal and absorb bar if it is empty avoiding the 1 pixel line they each have by default in that state. Can prob be placed in a better position and fixed in a much better way. - -- This fix is insipred by EvlUI's default function "UpdateFillBar" in their HealComm.lua, they use "if amount == 0 then bar:Hide()" there to do the same thing, calling it on UpdateHealComm. The reason I used SetAlpha instead is + -- code fix by StefanOyx to visually hide heal and absorb bar if it is empty avoiding the 1 pixel line they each have by default in that state. Can prob be placed in a better position and fixed in a much better way. + -- This fix is inspired by ElvUI's default function "UpdateFillBar" in their HealComm.lua, they use "if amount == 0 then bar:Hide()" there to do the same thing, calling it on UpdateHealComm. The reason I used SetAlpha instead is -- that for Zidras UpdateHealComm using :Hide() breaks bar positioning. - if healthPostHeal == health then - self.myBar:SetAlpha(0) - self.otherBar:SetAlpha(0) - else - self.myBar:SetAlpha(1) - self.otherBar:SetAlpha(1) - end - - if absorb == 0 then - healAbsorbBar:SetAlpha(0) - absorbBar:SetAlpha(0) - overAbsorb:SetAlpha(0) - else - healAbsorbBar:SetAlpha(1) - absorbBar:SetAlpha(1) - overAbsorb:SetAlpha(1) - end - - -- xD end of shit code + myBar:SetAlpha(myIncomingHeal == 0 and 0 or 1) + otherBar:SetAlpha(otherIncomingHeal == 0 and 0 or 1) + absorbBar:SetAlpha(absorb == 0 and 0 or 1) + healAbsorbBar:SetAlpha(healAbsorb == 0 and 0 or 1) -- handle over heal absorbs healAbsorbBar:ClearAllPoints()