WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   nUI: Developer Chat (https://www.wowinterface.com/forums/forumdisplay.php?f=96)
-   -   Pie slices for children buttons (https://www.wowinterface.com/forums/showthread.php?t=25363)

Rhamses 07-11-09 01:56 PM

Pie slices for children buttons
 
Here is the code from the original Demonomicon addon that places the children buttons around the original button.

It might be hard to dream up the code to do it, but it is pretty easy to use it as a template.

-------------------------------------------------------------------------------------------------------------
-- Slice the pie locations
-------------------------------------------------------------------------------------------------------------
if numButtons > 0 then
local angle = Placement.startAngle
local slice = (Placement.endAngle - angle) / numButtons
local radius = 18 / math.sin(slice / 2)
for index=1,numButtons do
Buttons[index]:SetPoint("CENTER", self, "CENTER", radius * math.cos(angle),
radius * math.sin(angle))
angle = angle + slice
end
self.Menu:SetWidth(radius * 2 + 36)
self.Menu:SetHeight(radius * 2 + 36)
end
end
-------------------------------------------------------------------------------------------------------------
-- Load pie slices with Textures
-------------------------------------------------------------------------------------------------------------
Demonomicon:SetScript("OnEvent", function (self, event, ...)
Demonomicon_Locale = {}
Demonomicon_Locale[GetLocale()] = Demonomicon_Locale[GetLocale()] or
({})[GetLocale()] or {}

self.Locale = Demonomicon_Locale[GetLocale()]
Demonomicon_Placement =
{
startAngle = math.pi,
endAngle = 3 * math.pi,
order =
{
self.Textures.Imp,
self.Textures.Infernal,
self.Textures.Voidwalker,
self.Textures.Succubus,
self.Textures.Felhunter,
self.Textures.Felguard
}
}
self.Placement = Demonomicon_Placement
self:SetScript('OnEvent', function (self, event, ...)
self:SetUpButtons(event, ...)end)
end)


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

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI