#Dynamic Group + TSU Trigger - set width of each bar

6 messages · Page 1 of 1 (latest)

manic raven
#

Hello, I've got a dynamic group that holds one WeakAura that has a TSU trigger. The trigger is responsible to show the essences of my Evoker. I'm using a TSU trigger to be able to show the recharge time of each essence.

I am now trying to adjust the size of the aura so the total width of all 5 (or 6) essences matches the width of another dynamic group which holds my rotation.

I am normally using a custom script in Actions -> Init for each of my resource bars on each class:

aura_env.minWidth = 200

aura_env.classNames = {
    "Warrior", 
    "Paladin", 
    "Hunter", 
    "Rogue", 
    "Priest", 
    "DK",
    "Shaman", 
    "Mage", 
    "Warlock", 
    "Monk", 
    "Druid", 
    "DH",
    "Evoker"
}

function aura_env:Init()    
    -- AUTO RESIZE
    local ctx = self.region.arcCustomContext
    if not ctx then
        ctx = {}
        self.region.arcCustomContext = ctx
    end
    
    local classBar = self:GetClassBarName()
    local parentRegion = WeakAuras.GetRegion(classBar)
    if not parentRegion then
        print(self.id, "could not find WA:", classBar)
        return
    end
    
    ctx.parentRegion = parentRegion
    ctx.minWidth = aura_env.minWidth
    ctx.region = self.region
    
    if not ctx.hooked then
        hooksecurefunc(ctx.parentRegion, "SetWidth", function(_, width)
                ctx.region:SetRegionWidth(max(ctx.minWidth, width))
        end)
        ctx.hooked = true
    end
end

function aura_env:GetClassBarName()
    local classIndex = select(3, UnitClass("player"))
    local className = aura_env.classNames[classIndex]
    
    return "Romp - " .. className .. " - Rotation"
end

aura_env:Init()

I've tried this, it doesn't change anything on the TSU auras width. I've then done some researching here in discord and found someone that used Actions -> Show -> Custom and only set the width by using:

aura_env.region:SetRegionWidth(100)

The first image shows the weakaura with no custom code, with a default width of "40". When I now tick Actions -> Show -> Init and execute the resize function mentioned in the second code snippet, it produces something like the second image - so it makes the bar a lot bigger, but it doesn't set the correct size and produces some very weird overlaps.

I'd appreciate any hints as to how to progress on this, as it's the last piece missing to my ui.

#

So if I put the Group's Grow to Custom, Run on "changed" and the custom grow to:

function(newPositions, activeRegions)
    local j = 0
    local width = nil
    for i = 1, #activeRegions do
        local region = activeRegions[i].region
        if region.regionType ~= "text" then
            j = j + 1
            width = width or region.width
            newPositions[i] = {(width + 1) * (-3.5 + j), 0}
        end
    end
end

The weird overlaps/borders are gone and I can set a size in Actions -> On Show -> Custom

#

However, the Actions -> On show won't trigger again when I lose an ability in my Rotation Custom Group when I change talents, for example

gleaming cradle
#

when you start messing with aura_env.region you're bound to get unintended behaviours