Thread Tools Display Modes
Prev Previous Post   Next Post Next
12-05-22, 02:26 PM   #1
Suilixua
A Murloc Raider
Join Date: Dec 2022
Posts: 4
Need help to check which width is greater

Basically I have a resource bar in WeakAuras and above is my primary dynamic group and below the resource Bar I got a secondary dynamic group.
I want that the resource Bar adjust the size depending on which of those 2 grps has a bigger width overall.

I tried it with

Code:
WeakAuras.regions[aura_env.id].region:SetFrameLevel(1)

if(not ProgressBarHooked)then
    local upEnv = aura_env;
    local function setWidthHook(self,width)
        upEnv.region:SetRegionWidth(width);
    end
    
    local topGroupRegion = WeakAuras.GetRegion("Demon Hunter » Primary Bar");
    local bottomGroupRegion = WeakAuras.GetRegion("Demon Hunter » Secondary Bar");
    
    topGroupRegionParent = topGroupRegion:GetParent();
    bottomGroupRegionParent = bottomGroupRegion:GetParent();
    
    
    if topGroupRegionParent:GetWidth() > bottomGroupRegionParent:GetWidth() then
        hooksecurefunc(topGroupRegion,"SetWidth",setWidthHook);
    else
        hooksecurefunc(bottomGroupRegion,"SetWidth",setWidthHook);
        ProgressBarHooked = true;
    end
end

Somehow it only uses the width of the secondary bar, eventhough the primary bar has a larger width.

If I change at the bottom the <"bottomGroupRegion, "SetWidth"> etc. with "topGroupRegion" it only adjusts to the primary bar.

So I guess I miss some small detail and would appreciate help.

https://medal.tv/clips/L0yaUaqwofV76...MTQ5MjMyNDM0LA - here u can see the problem in action

Last edited by Suilixua : 12-05-22 at 06:15 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Tutorials & Other Helpful Info. » Need help to check which width is greater


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off