oUF

97.2k Downloads

Aura position not updating correctly

Haleth opened this issue ยท 20 comments

commented

Since the latest updated to aura positioning, when using Auras with Auras.gap = true, debuffs don't revert to their original position after a buff which moved them has disappeared. They appear where the gap used to be. It's hard to explain, screenshots show it in more detail:

Buff appears:
http://img710.imageshack.us/img710/4879/wowscrnshot100111182147.jpg

Buff disappears:
http://img6.imageshack.us/img6/5717/wowscrnshot100111182150.jpg

    local Auras = CreateFrame("Frame", nil, self)
    Auras:SetPoint("TOPLEFT", self, "BOTTOMLEFT", 0, -4)
    Auras.initialAnchor = "TOPLEFT"
    Auras["growth-x"] = "RIGHT"
    Auras["growth-y"] = "DOWN"
    Auras['spacing-x'] = 3
    Auras['spacing-y'] = 3
    Auras.numDebuffs = 16
    Auras.numBuffs = 16
    Auras:SetHeight(500)
    Auras:SetWidth(229)
    Auras.size = 26
    Auras.gap = true

    self.Auras = Auras
commented

Basicly, the gap should be removed if there is no buffs?

commented

That's what I failed to say, yes. >_<

Worked fine before the updates.

commented

Gaps don't appear at all now after a buff expires.

commented

Debuffs now sometimes seem to appear in the buff's place.

commented

Should be solved with e53dcb1. I'm not too pleased with how it works now, but at least it will work like before, with slightly less re-anchoring.

I will probably rewrite how gaps are handled later on. Right now this is done in the anchoring phase, when it would be better to just create one "fake" extra buff, which is invisible. That way we can do full updates with proper gapping without having to re-anchor all of the aura icons from scratch.

I didn't remove the code which prevent oUF from re-anchoring entirely, as it should still reduce the amount of calls to :SetPosition() by quite a lot in raids.

commented

Seems to be fixed now, yeah. ^^

If you go for the fake buff method, make sure it disappears when there are no other buffs at all. Obvious, but just saying. :P

commented

No worries! Same seems to apply to count, btw.

Have an other problem though. I used to have a filter in my PostUpdateIcon which looked like this (ignore the debuff type colouring):

local PostUpdateIcon
do
local playerUnits = {
player = true,
pet = true,
vehicle = true,
}

PostUpdateIcon = function(icons, unit, icon, index, offset, filter, isDebuff)
    local texture = icon.icon
    local _, _, _, _, dtype, _, _, _, _, _, spellID = UnitAura(unit, index, icon.filter)
    if(unit~="target") then icon:Show() end
    if(not playerUnits[icon.owner] and not C.debuffFilter[spellID] and not UnitIsFriend("player", unit) and icon.debuff)
    or(UnitIsPlayer(unit) and not UnitIsFriend("player", unit) and not icon.debuff and not C.dangerousBuffs[spellID]) then
        icon:Hide()
    else
        icon:Show()
        if icon.debuff and dtype and UnitIsFriend("player", unit) then
            local color = DebuffTypeColor[dtype]
            icon.bg:SetVertexColor(color.r, color.g, color.b)
        else
            icon.bg:SetVertexColor(0, 0, 0)
        end
    end
end

end

Though now, it will display the 'gap' for every debuff that's hidden, so there can be like 8 gaps. I tried to change it to a CustomFilter like this:

local CustomFilter
do
local playerUnits = {
player = true,
pet = true,
vehicle = true,
}

CustomFilter = function(_, unit, icon, _, _, _, _, _, _, _, caster, _, _, spellID)
    if(not playerUnits[icon.owner] and not C.debuffFilter[spellID] and not UnitIsFriend("player", unit) and icon.debuff)
    or(UnitIsPlayer(unit) and not UnitIsFriend("player", unit) and not icon.debuff and not C.dangerousBuffs[spellID]) then
        return false
    end
    return true
end

end

But then it won't show any buffs on NPCs, whereas the previous would show all NPC buffs.

Not sure if this is a bug or I'm overlooking something.

commented

icon.owner will always be nil in a CustomFilter, as it gets set by the internal customfilter function. The same is true for icon.isPlayer.

commented

So I use OmniCC, and if a timer is shown on an icon and then a gap appears, the OmniCC count will still show. Is there any easy way to work around this?

commented

Looks like I forgot to hide the cooldown frame of the icon. :(

I'll push a fix when I get home.

commented

Then what would be the best way to keep my filter? Using CustomFilter doesn't seem like an option because I can't check whether it's a buff or debuff (since I'm stuck with using UnitAura).

commented

filter == "HARMFUL" works, IsDebuff seems to always return nil.

commented

icon.isDebuff works fine for me. It's provided because the filter can contain more than just HARMFUL, but only if the layout sets it.

commented

Hmm, it works now, even though I changed nothing. Awkward.

Thanks for all these changes. :) oUF is teaching me a lot more about lua.

commented

So I use OmniCC, and if a timer is shown on an icon and then a gap appears, the OmniCC count will still show. Is there any easy way to work around this?

I just checked the source and I do hide the cooldown frame. I don't hide the count however. I tested with OmniCC regardless, but it doesn't add a timer to the gap here. CustomFiltering also doesn't create fake gaps.

Are you using a custom :SetPosition() function?

commented

I'm not. Turns out it was an error on my side because I wasn't using the normal cooldown frame. >_>

Sorry to bug you with my questions.

commented

Then what would be the best way to keep my filter? Using CustomFilter doesn't seem like an option because I can't check whether it's a buff or debuff (since I'm stuck with using UnitAura).

I can change the function to expose .filter and .debuff, as well as moving .owner and .isPlayer out of the internal customFilter function.

commented

Note that CustomFilter is mainly intended to filter out icons you don't want to show and nothing else. PostUpdateIcon is there to deal with styling.

commented

That'd be great, it's really hard to get a filter going otherwise when using Auras now. :)

And yes, the style will still be handled by PostUpdateIcon, that's no problem.

commented

Changes pushed. I renamed icon.debuff to icon.isDebuff in the process.