WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   My CombatIndicator spawns "behind" the frame. (https://www.wowinterface.com/forums/showthread.php?t=56211)

dzreams 05-11-18 02:04 AM

My CombatIndicator spawns "behind" the frame.
 
Hello, first of all this project is really quite wonderful, but I'm running into a little issue where my CombatIndicator seems to spawn behind the actual frame:



If you look closely, the indicator is "infront" of the background, but "behind" the health bar - when I remove the statusbar elements this is still the case, so somehow I am drawing my statusbars in front of the indicator. I've tried a few things:
  • Hiding the statusbar backgrounds
  • Giving the statusbar and statusbar.bg different "layers"
  • Different order of things :)
But haven't got to a nice solution. Anyway, here are the relevant codes:

Code:

  self.Health = createStatusBar(self)
  self.Health:SetPoint("TOPLEFT", self, "TOPLEFT", conf.borderSize, -conf.borderSize)
  self.Health:SetPoint("TOPRIGHT", self, "TOPRIGHT", -conf.borderSize, -conf.borderSize)
  self.Health:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, -healthHeight)
  self.Health:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, -healthHeight)
  self.Health.colorSmooth = true
  self.Health.colorClass = true
  self.Health.bg.multiplier = conf.bgMultiplier

Code:

  if unit == "player" then
    self.CombatIndicator = self:CreateTexture(nil, "OVERLAY")
    self.CombatIndicator:SetPoint("CENTER", self, "TOP", 0, 0)
    self.CombatIndicator:SetSize(32, 32)
  end

Code:

local tex = [[Interface\AddOns\bdCore\media\smooth]]
ns.utils.createStatusBar = function (parent)
  local b = CreateFrame("StatusBar", nil, parent)
  b:SetStatusBarTexture(tex, "BORDER")
  b.bg = b:CreateTexture(nil, "BACKGROUND")
  b.bg:SetTexture(tex)
  b.bg:SetAllPoints()
  return b
end

Anyway - any help that you can give me, or hints in the right direction, would be most appreciated.

Thanks

p3lim 05-11-18 05:51 AM

Try this for the CombatIndicator
Lua Code:
  1. self.Health:CreateTexture

Aftermathhqt 05-11-18 01:49 PM

or make a invisible frame, that works too

Lua Code:
  1. local InvisFrame = CreateFrame("Frame", nil, self)
  2. InvisFrame:SetFrameLevel(Health:GetFrameLevel() + 5)
  3. InvisFrame:SetAllPoints()
  4.  
  5. local Combat = InvisFrame:CreateTexture(nil, "OVERLAY")
  6. Combat:Size(20, 20)
  7. Combat:Point("TOP", self, 0, 9)

dzreams 05-11-18 04:10 PM

Both of those suggestions helped immensely. Thankyou very much.

Seerah 05-11-18 08:01 PM

Quote:

Originally Posted by Aftermathhqt (Post 327942)
or make a invisible frame, that works too

Lua Code:
  1. local InvisFrame = CreateFrame("Frame", nil, self)
  2. InvisFrame:SetFrameLevel(Health:GetFrameLevel() + 5)
  3. InvisFrame:SetAllPoints()
  4.  
  5. local Combat = InvisFrame:CreateTexture(nil, "OVERLAY")
  6. Combat:Size(20, 20)
  7. Combat:Point("TOP", self, 0, 9)

But then you end up with an extra, irrelevant frame. Instead, just use :SetDrawLayer() on the texture to make it draw higher than the healthbar.


All times are GMT -6. The time now is 04:04 PM.

vBulletin © 2019, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI