WeakAuras / WeakAuras2

World of Warcraft addon that provides a powerful framework to display customizable graphics on your screen.
https://weakauras.wtf
GNU General Public License v2.0
1.31k stars 318 forks source link

Dynamic Group: Optimize unit frame/namplate anchoring #4055

Open InfusOnWoW opened 1 year ago

InfusOnWoW commented 1 year ago

Whenever a state changes, we essentially iterate over all regions to sort/grow them.

We can optimize that by introducing another abstraction, which iirc was part of the dg2 work by rivers.

That is introuce the concept of a "container", that handles the sorting/layout of all regions that are attached to the same frame and provides api to add/remove regions to themselve.

So if a state changes: If the region stays in the ame container we only need to sort/layout that container. And otherwise remove it from the previous container and add it to the next.

emptyrivers commented 1 year ago

Just to clarify on the specific strategy I had been going for, the dynamic group asks for each child (on the usual activate/state change), 'where' they want to be distributed to

some considerations to deal with:

emptyrivers commented 1 year ago

In such a container approach, having the anchor point (TOP, CENTER, BOTTOMRIGHT, etc) be part of the container identifier might also be valuable. For example, a user could wish to create a dynamic group which tracked specific buffs and debuffs in an encounter, and anchors the buffs to TOPLEFT (growing right), while debuffs are anchored to BOTTOMLEFT (also growing right).