View Single Post
12-25-10, 04:09 AM   #1
Talyrius
An Onyxian Warder
 
Talyrius's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 363
Adding an overlay to HealPrediction bars

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:
  1. ------------------------------
  2. -- Element: Heal Prediction --
  3. ------------------------------
  4.  
  5. local mhpb = ns.CreateStatusBar(self.Health)
  6. mhpb:SetPoint('TOPLEFT', self.Health:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
  7. mhpb:SetPoint('BOTTOMLEFT', self.Health:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
  8. mhpb:SetWidth(self.Health:GetWidth())
  9. mhpb:SetStatusBarColor(0, 1, 0.5, 0.4)
  10. mhpb.bg:ClearAllPoints()
  11. mhpb.bg:SetTexture("")
  12. mhpb.bg:Hide()
  13. mhpb.bg = nil
  14. mhpb.spacer = mhpb:CreateTexture(nil, "OVERLAY")
  15. mhpb.spacer:SetTexture([[Interface\Buttons\WHITE8x8]])
  16. mhpb.spacer:SetPoint('TOPLEFT', mhpb:GetStatusBarTexture(), 'TOPRIGHT', -1, 0)
  17. mhpb.spacer:SetPoint('BOTTOMLEFT', mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', -1, 0)
  18. mhpb.spacer:SetVertexColor(0, 0, 0)
  19. mhpb.spacer:SetWidth(1)
  20.  
  21. local ohpb = ns.CreateStatusBar(self.Health)
  22. ohpb:SetPoint('TOPLEFT', mhpb:GetStatusBarTexture(), 'TOPRIGHT', 0, 0)
  23. ohpb:SetPoint('BOTTOMLEFT', mhpb:GetStatusBarTexture(), 'BOTTOMRIGHT', 0, 0)
  24. ohpb:SetWidth(self.Health:GetWidth())
  25. ohpb:SetStatusBarColor(0, 1, 0, 0.4)
  26. ohpb.bg:ClearAllPoints()
  27. ohpb.bg:SetTexture("")
  28. ohpb.bg:Hide()
  29. ohpb.bg = nil
  30. ohpb.spacer = ohpb:CreateTexture(nil, "OVERLAY")
  31. ohpb.spacer:SetTexture([[Interface\Buttons\WHITE8x8]])
  32. ohpb.spacer:SetPoint('TOPLEFT', ohpb:GetStatusBarTexture(), 'TOPRIGHT', -1, 0)
  33. ohpb.spacer:SetPoint('BOTTOMLEFT', ohpb:GetStatusBarTexture(), 'BOTTOMRIGHT', -1, 0)
  34. ohpb.spacer:SetVertexColor(0, 0, 0)
  35. ohpb.spacer:SetWidth(1)
  36.  
  37. self.HealPrediction = { myBar = mhpb, otherBar = ohpb, maxOverflow = 1 }
  Reply With Quote