@@ -72,20 +72,29 @@ function TB:UpdateAura(button, index)
7272 button .Icon :SetTexture (auraData .icon )
7373end
7474
75-
76- function TB :OnAttributeChanged (attribute , value )
75+ function TB .OnAttributeChanged (self , attribute , value )
7776 if attribute == ' index' then
7877 TB :UpdateAura (self , value )
7978 end
8079end
8180
81+ TB .AttributeInitialConfig = [[
82+ local header = self:GetParent()
83+
84+ self:SetWidth(header:GetAttribute('config-width'))
85+ self:SetHeight(header:GetAttribute('config-height'))
86+ ]]
87+
8288function TB :UpdateHeader (header )
83- header :SetAttribute (' template' , format (' TorghastBuffsTemplate%d' , TB .db .size ))
89+ header :SetAttribute (' config-width' , TB .db .size )
90+ header :SetAttribute (' config-height' , TB .db .size )
91+ header :SetAttribute (' template' , ' TorghastBuffsTemplate' )
8492 header :SetAttribute (' sortMethod' , TB .db .sortMethod )
8593 header :SetAttribute (' sortDirection' , TB .db .sortDir )
8694 header :SetAttribute (' maxWraps' , TB .db .maxWraps )
8795 header :SetAttribute (' wrapAfter' , TB .db .wrapAfter )
8896 header :SetAttribute (' point' , DIRECTION_TO_POINT [TB .db .growthDirection ])
97+ header :SetAttribute (' initialConfigFunction' , TB .AttributeInitialConfig )
8998
9099 if IS_HORIZONTAL_GROWTH [TB .db .growthDirection ] then
91100 header :SetAttribute (' minWidth' , ((TB .db .wrapAfter == 1 and 0 or TB .db .horizontalSpacing ) + TB .db .size ) * TB .db .wrapAfter )
123132function TB :CreateAuraHeader (unit , unitName )
124133 local header = CreateFrame (' Frame' , ' TorghastBuffs_' .. unitName , TB .Holder , ' TorghastBuffsHeaderTemplate' )
125134 header :SetAttribute (' unit' , unit )
135+ header :ClearAllPoints ()
136+ header :UnregisterAllEvents ()
137+ header :RegisterUnitEvent (' UNIT_AURA' , unit )
126138 header .unit = unit
127139
128140 TB :UpdateHeader (header )
@@ -223,18 +235,12 @@ function TB:Initialize()
223235 end
224236
225237 TB .Holder .PlayerBuffFrame = TB :CreateAuraHeader (' player' , ' Player' )
226- TB .Holder .PlayerBuffFrame :ClearAllPoints ()
227238 TB .Holder .PlayerBuffFrame :SetPoint (' TOPLEFT' , TB .Holder , ' TOPLEFT' , 0 , 0 )
228- TB .Holder .PlayerBuffFrame :UnregisterAllEvents ()
229- TB .Holder .PlayerBuffFrame :RegisterUnitEvent (' UNIT_AURA' , ' player' )
230239
231240 for i = 1 , 4 do
232241 local name = format (' Party%dBuffFrame' , i )
233242 TB .Holder [name ] = TB :CreateAuraHeader (' party' .. i , ' Party' .. i )
234- TB .Holder [name ]:ClearAllPoints ()
235243 TB .Holder [name ]:SetPoint (' TOPLEFT' , i == 1 and TB .Holder .PlayerBuffFrame or TB .Holder [format (' Party%dBuffFrame' , i - 1 )], ' BOTTOMLEFT' , 0 , - 25 )
236- TB .Holder [name ]:UnregisterAllEvents ()
237- TB .Holder [name ]:RegisterUnitEvent (' UNIT_AURA' , ' party' .. i )
238244 end
239245
240246 if PA .ElvUI then
0 commit comments