Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic resizing of Icons in a dynamic group to fit a fixed size defined for the group #2878

Closed
psyquest opened this issue Jan 8, 2021 · 6 comments
Labels
🎨 Feature Request This is a request for a new feature, or an expansion of an existing feature.

Comments

@psyquest
Copy link

psyquest commented Jan 8, 2021

Is your feature request related to a problem? Please describe.
When adding icons to a dynamic group it is impossible to set a max lenght for the group so that adding icons does not enlarge the group. Since unit frames are in set places on the screen, players usully set their icons between the player and target unitframe. Unfortunately, there is no way to control the size of the dynamic group (depends on talents/spells selected) and thus we end up with not so nice UIs with varying lenght of dynamic groups.

Describe the solution you'd like
When creating a dynamic group, depending on talents choice there can be X icons or X+n icons
Ideally one would like to have all icons in a dynamic group fit a predefined maximum lenght of the dynamic group.
So that adding extra icons to a dynamic group, the lenght of the dynamic group does not change but the size of icons dynamically change to fit the predefined dynamic group lenght.

This makes for visually pleasing UI.

Describe alternatives you've considered
yes, tried using code such as the one used here https://wago.io/kib-dh-hud
But would rather have it done natively by weak aura, especially this would be used by many classes.

@psyquest psyquest added the 🎨 Feature Request This is a request for a new feature, or an expansion of an existing feature. label Jan 8, 2021
@MikeCook9994
Copy link

+1 I was coming here to submit this same feature request. Typically, my talent selections will give a UI looking something like this:
image

But worse case, with talent selections I can get this (soothe icon collides with barkskin icon):
image

If I could specify a max width (not simply an icon limit) for the the top row of icons, the dynamic group as a whole could scale down to fit within the max width (or even scale up to fit within a min width)

@pschultz
Copy link

pschultz commented Apr 2, 2022

It took quite some googling, but I finaly found a post on Reddit that suggesting using a custom grow function for the dynamic group. In the grow function one can change the width and/or height of the group's children. The following code reproduces the native "Centered Horizontal" placement and changes the width of the group's icon to perfectly fit 180 px horizontally:

-- https://github.com/WeakAuras/WeakAuras2/wiki/Custom-Dynamic-Group#custom-grow

function(newPositions, activeRegions)
    local totalWidth = 180
    local width = totalWidth / #activeRegions
    
    for i = 1, #activeRegions do
        -- Changing only the icon width. I prefer to have constant height,
        -- which means that icons may not be square. To keep icons square,
        -- add `activeRegions[i].region:SetRegionHeight(width)`
        activeRegions[i].region:SetRegionWidth(width)
        
        newPositions[i] = {
            i*width - totalWidth/2 - width/2, -- x
            0                                 -- y
        }
    end
end

Here's part of my UI using the custom grow function above. Just so there's no confusion, the picture shows three distinct dynamic groups: one below the player unit frame, and two groups between the player and target frames.

wow-wa-dynamic-icon-size

@gollumeo
Copy link

I dunno if I'll ever have an answer given the late comment, but how could I possibly change the spacing between icons/auras with that code?

@pschultz
Copy link

@gollumeo, I can't test right now, but something like this should work:

  • in SetRegionWidth(width) replace width with width-X,
  • in i*width - totalWidth/2 - width/2 replace width with (width+X);

where X is the desired spacing

        activeRegions[i].region:SetRegionWidth(width-2)
        
        newPositions[i] = {
            i*(width+2) - totalWidth/2 - (width+2)/2, -- x
            0                                         -- y
        }

@gollumeo
Copy link

It works, ty! It asks to change some parameters (like the total width) to actually fit the initial pattern, but that's what I needed! Thanks a lot ♥

@InfusOnWoW
Copy link
Contributor

Duplicate of #4057

@InfusOnWoW InfusOnWoW marked this as a duplicate of #4057 Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 Feature Request This is a request for a new feature, or an expansion of an existing feature.
Projects
None yet
Development

No branches or pull requests

5 participants