Merry Christmas, everyone!
I'm experiencing some complications by adding a one pixel wide overlay to the edge of the heal prediction bars. It works as expected, but the problem is they still display even when the heal prediction bars aren't visible (zero width).
Does anyone have any suggestions on how I should go about fixing this? Perhaps I need to use a Pre/PostUpdate or something? A code example would be helpful.
Thank you.
The code pertaining to my question:
lua Code:
------------------------------
-- Element: Heal Prediction --
------------------------------
local mhpb = ns.CreateStatusBar(self.Health)
mhpb:SetPoint('TOPLEFT', self.Health:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
mhpb:SetPoint('BOTTOMLEFT', self.Health:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
mhpb:SetWidth(self.Health:GetWidth())
mhpb:SetStatusBarColor(0, 1, 0.5, 0.4)
mhpb.bg:ClearAllPoints()
mhpb.bg:SetTexture("")
mhpb.bg:Hide()
mhpb.bg = nil
mhpb.spacer = mhpb:CreateTexture(nil, "OVERLAY")
mhpb.spacer:SetTexture([[Interface\Buttons\WHITE8x8]])
mhpb.spacer:SetPoint('TOPLEFT', mhpb:GetStatusBarTexture(), 'TOPRIGHT', -1, 0)
mhpb.spacer:SetPoint('BOTTOMLEFT', mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', -1, 0)
mhpb.spacer:SetVertexColor(0, 0, 0)
mhpb.spacer:SetWidth(1)
local ohpb = ns.CreateStatusBar(self.Health)
ohpb:SetPoint('TOPLEFT', mhpb:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
ohpb:SetPoint('BOTTOMLEFT', mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
ohpb:SetWidth(self.Health:GetWidth())
ohpb:SetStatusBarColor(0, 1, 0, 0.4)
ohpb.bg:ClearAllPoints()
ohpb.bg:SetTexture("")
ohpb.bg:Hide()
ohpb.bg = nil
ohpb.spacer = ohpb:CreateTexture(nil, "OVERLAY")
ohpb.spacer:SetTexture([[Interface\Buttons\WHITE8x8]])
ohpb.spacer:SetPoint('TOPLEFT', ohpb:GetStatusBarTexture(), 'TOPRIGHT', -1, 0)
ohpb.spacer:SetPoint('BOTTOMLEFT', ohpb:GetStatusBarTexture(), 'BOTTOMRIGHT', -1, 0)
ohpb.spacer:SetVertexColor(0, 0, 0)
ohpb.spacer:SetWidth(1)
self.HealPrediction = { myBar = mhpb, otherBar = ohpb, maxOverflow = 1 }