Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dynamic group: follow sorting for level of auras and their subregions…
Browse files Browse the repository at this point in the history
…, with option to use the reverse of actual sorting
mrbuds committed Nov 9, 2023
1 parent 108356d commit efbdbb9
Showing 3 changed files with 33 additions and 1 deletion.
9 changes: 8 additions & 1 deletion WeakAuras/RegionTypes/DynamicGroup.lua
Original file line number Diff line number Diff line change
@@ -1047,7 +1047,6 @@ local function clearCache(cache, id, cloneId)
end

local function modify(parent, region, data)
Private.FixGroupChildrenOrderForGroup(data)
region:SetScale(data.scale and data.scale > 0 and data.scale <= 10 and data.scale or 1)
Private.regionPrototype.modify(parent, region, data)

@@ -1518,6 +1517,14 @@ local function modify(parent, region, data)
end
end

local frameLevel = 1
local fn = data.reverseLevel and ipairs_reverse or ipairs
for _, child in fn(self.sortedChildren) do
if handledRegionData[child] then
frameLevel = Private.SetRegionLevel(child.region, frameLevel)
end
end

Private.StopProfileSystem("dynamicgroup")
Private.StopProfileAura(data.id)
self:Resize()
19 changes: 19 additions & 0 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
@@ -4081,6 +4081,25 @@ function Private.ApplyFrameLevel(region, frameLevel)
end
end

function Private.SetRegionLevel(region, frameLevel)
region:SetFrameLevel(frameLevel)
if region.subRegions then
for index, subRegion in pairs(region.subRegions) do
if subRegion.type == "subbackground" then
subRegion:SetFrameLevel(frameLevel + index)
end
end

for index, subRegion in pairs(region.subRegions) do
if subRegion.type ~= "subbackground" then
subRegion:SetFrameLevel(frameLevel + index)
end
end
return frameLevel + #region.subRegions + 1
end
return frameLevel + 1
end

function WeakAuras.EnsureString(input)
if (input == nil) then
return "";
6 changes: 6 additions & 0 deletions WeakAurasOptions/RegionOptions/DynamicGroup.lua
Original file line number Diff line number Diff line change
@@ -486,6 +486,12 @@ local function createOptions(id, data)
order = 24,
hidden = function() return data.sort == "hybrid" end
},
reverseLevel = {
type = "toggle",
order = 24.5,
width = WeakAuras.doubleWidth,
name = L["Reverse children level ordering"],
},
useLimit = {
type = "toggle",
order = 25,

0 comments on commit efbdbb9

Please sign in to comment.