WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   SecureGroupHeader InitialConfig scale does not affect header (https://www.wowinterface.com/forums/showthread.php?t=54831)

zork 11-15-16 12:46 PM

SecureGroupHeader InitialConfig scale does not affect header
 
When a scale is set in the initialconfiguration of a secure groupheader unit button it affects the button, but not the header.

Lua Code:
  1. "oUF-initialConfigFunction", ([[
  2.         self:SetWidth(%d)
  3.         self:SetHeight(%d)
  4.         self:SetScale(%f)
  5.       ]]):format(110,26,0.5)

The result is sth like this:

0.5 scale:
http://imgur.com/a/OWWvn

0.8 scale:
http://imgur.com/a/ifeUa

1 scale:
http://imgur.com/a/PrqBh

1.25 scale: (header does not even fit all the unit buttons!)
http://imgur.com/a/1mdHn

The header resize calculation works of the unit button width/height (https://github.com/tomrus88/Blizzard...aders.lua#L231), but for whatever reason it is ignoring the scale of the button resulting in a way to large unit header on low scale values and to low size if the scale is > 1.

This destroys all offsets since it only works for scale 1 properly.

Resike 11-15-16 01:14 PM

I see what are you saying now, what happens if you create your unitbutton like this then?

Lua Code:
  1. self.headers[i]:SetAttribute("style-width", 68)
  2. self.headers[i]:SetAttribute("style-height", 41)
  3. self.headers[i]:SetAttribute("style-scale", 1)
  4.  
  5. self.headers[i]:SetAttribute("initialConfigFunction", [[
  6.     local header = self:GetParent()
  7.  
  8.     self:SetHeight(header:GetAttribute("style-height") * header:GetAttribute("style-scale"))
  9.     self:SetWidth(header:GetAttribute("style-width") * header:GetAttribute("style-scale"))
  10.     --self:SetScale(header:GetAttribute("style-scale"))
  11.  
  12.     header:CallMethod("initialConfigFunction", self:GetName())
  13. ]])

No scale attribute or 1, just setting the width/height multiplied with the scale itself.

Edit:
I think the style-scale attribute is broken too, if you use a simple SetScale on the header that should also get applied on every unit child which will also scale up the unit button's width/height and the offsets will work properly too:

self.headers[i]:SetScale(1)

zork 11-15-16 02:53 PM

I tried any variant of applying init-scale. None of them had an effect.

Resike 11-15-16 05:52 PM

Quote:

Originally Posted by zork (Post 320854)
I tried any variant of applying init-scale. None of them had an effect.

You do this outside of the init function, where you've created your header frame. Might not be possible to do with oUF tho.

You could try to do this too:

Lua Code:
  1. self.header:SetAttribute("initialConfigFunction", [[
  2.     local header = self:GetParent()
  3.     header:SetScale(1.2)
  4.  
  5.     header:CallMethod("initialConfigFunction", self:GetName())
  6. ]])

zork 11-17-16 08:19 AM

I will try your last idea later. The implementation has to be secure. Otherwise it is of no use since raid headers can be spawned in combat.

Maybe I can do this:
Lua Code:
  1. "oUF-initialConfigFunction", ([[
  2.   self:SetWidth(%d)
  3.   self:SetHeight(%d)
  4.   self:GetParent():SetScale(%f)
  5. ]]):format(110,26,0.5)

*edit*

Tested it. The above is the solution!

It works if you set the header scale instead of the unit button scale inside the initialConfiguration.


All times are GMT -6. The time now is 02:51 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI