Skip to content

Commit

Permalink
Add new angle-based constant factor for circular dynamic group grow s…
Browse files Browse the repository at this point in the history
…tyles (#4646)
  • Loading branch information
wtodom authored Oct 15, 2023
1 parent 5c24788 commit 2560dfe
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 10 deletions.
11 changes: 9 additions & 2 deletions WeakAuras/RegionTypes/DynamicGroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local default = {
yOffset = 0,
radius = 200,
rotation = 0,
stepAngle = 15,
fullCircle = true,
arcLength = 360,
constantFactor = "RADIUS",
Expand Down Expand Up @@ -718,6 +719,7 @@ local growers = {
local constantFactor = data.constantFactor
local space = data.space or 0
local radius = data.radius or 0
local stepAngle = (data.stepAngle or 0) * math.pi / 180
local limit = data.useLimit and data.limit or math.huge
local sAngle = (data.rotation or 0) * math.pi / 180
local arc = (data.fullCircle and 360 or data.arcLength or 0) * math.pi / 180
Expand All @@ -735,7 +737,7 @@ local growers = {
for frame, regionDatas in pairs(frames) do
local numVisible = min(limit, #regionDatas)
local r
if constantFactor == "RADIUS" then
if constantFactor == "RADIUS" or constantFactor == "ANGLE" then
r = radius
else
if numVisible <= 1 then
Expand All @@ -748,6 +750,8 @@ local growers = {
local dAngle
if numVisible == 1 then
dAngle = 0
elseif constantFactor == "ANGLE" then
dAngle = stepAngle
elseif not data.fullCircle then
dAngle = arc / (numVisible - 1)
else
Expand All @@ -769,6 +773,7 @@ local growers = {
local constantFactor = data.constantFactor
local space = data.space or 0
local radius = data.radius or 0
local stepAngle = (data.stepAngle or 0) * math.pi / 180
local limit = data.useLimit and data.limit or math.huge
local sAngle = (data.rotation or 0) * math.pi / 180
local arc = (data.fullCircle and 360 or data.arcLength or 0) * math.pi / 180
Expand All @@ -786,7 +791,7 @@ local growers = {
for frame, regionDatas in pairs(frames) do
local numVisible = min(limit, #regionDatas)
local r
if constantFactor == "RADIUS" then
if constantFactor == "RADIUS" or constantFactor == "ANGLE" then
r = radius
else
if numVisible <= 1 then
Expand All @@ -799,6 +804,8 @@ local growers = {
local dAngle
if numVisible == 1 then
dAngle = 0
elseif constantFactor == "ANGLE" then
dAngle = -stepAngle
elseif not data.fullCircle then
dAngle = arc / (1 - numVisible)
else
Expand Down
1 change: 1 addition & 0 deletions WeakAuras/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Private.glow_frame_types = {

--- @type table<dynamicGroupCircularTypes, string>
Private.circular_group_constant_factor_types = {
ANGLE = L["Angle and Radius"],
RADIUS = L["Radius"],
SPACING = L["Spacing"]
}
Expand Down
44 changes: 36 additions & 8 deletions WeakAurasOptions/RegionOptions/DynamicGroup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ local function createOptions(id, data)
name = L["Constant Factor"],
order = 4,
values = OptionsPrivate.Private.circular_group_constant_factor_types,
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
hidden = function() return not(data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") end
},
rotation = {
type = "range",
Expand All @@ -269,14 +269,31 @@ local function createOptions(id, data)
min = 0,
max = 360,
bigStep = 3,
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
hidden = function() return not(data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") end
},
fullCircle = {
type = "toggle",
width = WeakAuras.normalWidth,
name = L["Full Circle"],
order = 7,
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
hidden = function()
return not(
(data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE")
and (data.constantFactor == "RADIUS" or data.constantFactor == "SPACING"))
end
},
stepAngle = {
type = "range",
control = "WeakAurasSpinBox",
width = WeakAuras.normalWidth,
name = L["Angle Between Auras"],
order = 12,
min = 0,
max = 180,
bigStep = 1,
hidden = function()
return not((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "ANGLE")
end
},
arcLength = {
type = "range",
Expand All @@ -288,7 +305,11 @@ local function createOptions(id, data)
max = 360,
bigStep = 3,
disabled = function() return data.fullCircle end,
hidden = function() return data.grow ~= "CIRCLE" and data.grow ~= "COUNTERCIRCLE" end
hidden = function()
return not(
(data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE")
and (data.constantFactor == "RADIUS" or data.constantFactor == "SPACING"))
end
},
radius = {
type = "range",
Expand All @@ -299,7 +320,11 @@ local function createOptions(id, data)
softMin = 0,
softMax = 500,
bigStep = 1,
hidden = function() return data.grow == "CUSTOM" or not((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS") end
hidden = function()
return not(
(data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE")
and (data.constantFactor == "RADIUS" or data.constantFactor == "ANGLE"))
end
},
-- grid grow options
gridType = {
Expand Down Expand Up @@ -367,9 +392,12 @@ local function createOptions(id, data)
softMax = 300,
bigStep = 1,
hidden = function()
return data.grow == "CUSTOM"
or data.grow == "GRID"
or ((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE") and data.constantFactor == "RADIUS")
return not(
data.grow == "LEFT" or data.grow == "RIGHT"
or data.grow == "UP" or data.grow == "DOWN"
or data.grow == "HORIZONTAL" or data.grow == "VERTICAL"
or ((data.grow == "CIRCLE" or data.grow == "COUNTERCIRCLE")
and (data.constantFactor == "SPACING")))
end
},
stagger = {
Expand Down

0 comments on commit 2560dfe

Please sign in to comment.