Harden module initialization order
This commit is contained in:
@@ -11,61 +11,72 @@ local module = ShaguTweaks:register({
|
|||||||
})
|
})
|
||||||
|
|
||||||
module.enable = function(self)
|
module.enable = function(self)
|
||||||
-- overwrite config
|
if not ShaguTweaks.RaidFrame_OnReady then return end
|
||||||
ShaguTweaksRaidCluster.config["raid.width"] = 64
|
|
||||||
ShaguTweaksRaidCluster.config["raid.height"] = 12
|
|
||||||
ShaguTweaksRaidCluster.config["raid.rows"] = 40
|
|
||||||
|
|
||||||
-- disable mana bars
|
ShaguTweaks.RaidFrame_OnReady(function(raid)
|
||||||
ShaguTweaks.UnitFrame_NewComponent('compact layout', {
|
-- overwrite config before unit frames are created
|
||||||
events = { },
|
raid.cluster.config["raid.width"] = 64
|
||||||
create = function(frame)
|
raid.cluster.config["raid.height"] = 12
|
||||||
frame.compact = true
|
raid.cluster.config["raid.rows"] = 40
|
||||||
|
|
||||||
-- hide mana bar
|
-- disable mana bars
|
||||||
frame.mana:Hide()
|
ShaguTweaks.UnitFrame_NewComponent('compact layout', {
|
||||||
|
events = { },
|
||||||
|
create = function(frame)
|
||||||
|
frame.compact = true
|
||||||
|
|
||||||
-- move player text to healthbar
|
-- hide mana bar
|
||||||
frame.text:SetParent(frame.bar)
|
frame.mana:Hide()
|
||||||
frame.icon:SetParent(frame.bar)
|
|
||||||
-- move raid icon
|
|
||||||
frame.icon:ClearAllPoints()
|
|
||||||
frame.icon:SetPoint("LEFT", frame.bar, "LEFT", 0, 0)
|
|
||||||
|
|
||||||
end,
|
-- move player text to healthbar
|
||||||
update = function(frame, event)
|
frame.text:SetParent(frame.bar)
|
||||||
-- compact mode is handled by the base text component
|
frame.icon:SetParent(frame.bar)
|
||||||
|
|
||||||
|
-- move raid icon
|
||||||
|
frame.icon:ClearAllPoints()
|
||||||
|
frame.icon:SetPoint("LEFT", frame.bar, "LEFT", 0, 0)
|
||||||
|
end,
|
||||||
|
update = function(frame, event)
|
||||||
|
-- compact mode is handled by the base text component
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
local headerTitle = T["Show Group Headers"]
|
||||||
|
local headerEnabled = ShaguTweaks_config and ShaguTweaks_config[headerTitle]
|
||||||
|
if headerEnabled == nil then
|
||||||
|
local headerModule = ShaguTweaks.mods and ShaguTweaks.mods[headerTitle]
|
||||||
|
headerEnabled = headerModule and headerModule.enabled and 1 or 0
|
||||||
end
|
end
|
||||||
})
|
|
||||||
|
|
||||||
-- wait for the game to be loaded
|
-- No header module means there is nothing to wait for or reposition.
|
||||||
local delay = CreateFrame("Frame")
|
if headerEnabled ~= 1 then return end
|
||||||
delay:SetScript("OnUpdate", function()
|
|
||||||
this.elapsed = (this.elapsed or 0) + arg1
|
local delay = CreateFrame("Frame")
|
||||||
|
delay:SetScript("OnUpdate", function()
|
||||||
|
this.elapsed = (this.elapsed or 0) + (arg1 or 0)
|
||||||
|
this.total = (this.total or 0) + (arg1 or 0)
|
||||||
if this.elapsed < .10 then return end
|
if this.elapsed < .10 then return end
|
||||||
this.elapsed = 0
|
this.elapsed = 0
|
||||||
|
|
||||||
if ShaguTweaksRaidHeaders then
|
if ShaguTweaksRaidHeaders then
|
||||||
-- modify group headers
|
for i = 1, 8 do
|
||||||
for i=1, 8 do
|
|
||||||
if ShaguTweaksRaidHeaders[i] then
|
if ShaguTweaksRaidHeaders[i] then
|
||||||
-- read raid anchor per group header
|
|
||||||
local _, anchor = ShaguTweaksRaidHeaders[i]:GetPoint()
|
local _, anchor = ShaguTweaksRaidHeaders[i]:GetPoint()
|
||||||
|
if anchor then
|
||||||
-- remove background and move to the left
|
ShaguTweaksRaidHeaders[i]:ClearAllPoints()
|
||||||
--ShaguTweaksRaidHeaders[i]:SetBackdrop(nil)
|
ShaguTweaksRaidHeaders[i]:SetPoint("LEFT", anchor, "LEFT", -6, 6)
|
||||||
ShaguTweaksRaidHeaders[i]:ClearAllPoints()
|
ShaguTweaksRaidHeaders[i]:SetWidth(16)
|
||||||
ShaguTweaksRaidHeaders[i]:SetPoint("LEFT", anchor, "LEFT", -6, 6)
|
ShaguTweaksRaidHeaders[i]:SetHeight(16)
|
||||||
ShaguTweaksRaidHeaders[i]:SetWidth(16)
|
ShaguTweaksRaidHeaders[i].text:SetText(i)
|
||||||
ShaguTweaksRaidHeaders[i]:SetHeight(16)
|
ShaguTweaksRaidHeaders[i]:SetAlpha(.75)
|
||||||
--ShaguTweaksRaidHeaders[i].text:SetTextColor(.5,.5,.5,1)
|
end
|
||||||
ShaguTweaksRaidHeaders[i].text:SetText(i)
|
|
||||||
ShaguTweaksRaidHeaders[i]:SetAlpha(.75)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- disable delay only after headers were actually available
|
this:Hide()
|
||||||
|
elseif this.total >= 10 then
|
||||||
|
-- Fail closed instead of polling forever if headers never materialize.
|
||||||
this:Hide()
|
this:Hide()
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ module.enable = function(self)
|
|||||||
update = function(frame, event)
|
update = function(frame, event)
|
||||||
-- ignore empty or unrelated events
|
-- ignore empty or unrelated events
|
||||||
if not event then return end
|
if not event then return end
|
||||||
if arg1 and this.unitstr ~= arg1 then return end
|
if arg1 and frame.unitstr ~= arg1 then return end
|
||||||
|
|
||||||
-- affected debuffs
|
-- affected debuffs
|
||||||
frame.affected = frame.affected or {}
|
frame.affected = frame.affected or {}
|
||||||
|
|||||||
+36
-32
@@ -11,47 +11,51 @@ local module = ShaguTweaks:register({
|
|||||||
})
|
})
|
||||||
|
|
||||||
module.enable = function(self)
|
module.enable = function(self)
|
||||||
local raid = ShaguTweaksRaidFrame
|
if not ShaguTweaks.RaidFrame_OnReady then return end
|
||||||
if not raid then return end
|
|
||||||
|
|
||||||
local originals = {}
|
ShaguTweaks.RaidFrame_OnReady(function(raid)
|
||||||
local hidden = false
|
local originals = {}
|
||||||
|
local hidden = false
|
||||||
for i = 1, MAX_PARTY_MEMBERS do
|
|
||||||
local frame = _G["PartyMemberFrame" .. i]
|
|
||||||
if frame then originals[frame] = frame.Show end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function SetPartyFramesHidden(state)
|
|
||||||
if state == hidden then return end
|
|
||||||
hidden = state
|
|
||||||
|
|
||||||
for i = 1, MAX_PARTY_MEMBERS do
|
for i = 1, MAX_PARTY_MEMBERS do
|
||||||
local frame = _G["PartyMemberFrame" .. i]
|
local frame = _G["PartyMemberFrame" .. i]
|
||||||
if frame then
|
if frame then originals[frame] = frame.Show end
|
||||||
if state then
|
end
|
||||||
frame.Show = function() return end
|
|
||||||
frame:Hide()
|
local function SetPartyFramesHidden(state)
|
||||||
else
|
if state == hidden then return end
|
||||||
frame.Show = originals[frame]
|
hidden = state
|
||||||
if GetPartyMember(i) then frame:Show() else frame:Hide() end
|
|
||||||
|
for i = 1, MAX_PARTY_MEMBERS do
|
||||||
|
local frame = _G["PartyMemberFrame" .. i]
|
||||||
|
if frame then
|
||||||
|
if state then
|
||||||
|
frame.Show = function() return end
|
||||||
|
frame:Hide()
|
||||||
|
else
|
||||||
|
frame.Show = originals[frame]
|
||||||
|
if GetPartyMember(i) then frame:Show() else frame:Hide() end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
local function UpdatePartyFrames()
|
local function UpdatePartyFrames()
|
||||||
SetPartyFramesHidden(raid:IsShown())
|
local active = raid:IsShown() and raid.cluster and raid.cluster:IsShown()
|
||||||
end
|
SetPartyFramesHidden(active and true or false)
|
||||||
|
end
|
||||||
|
|
||||||
ShaguTweaks.HookScript(raid, "OnShow", UpdatePartyFrames)
|
ShaguTweaks.HookScript(raid, "OnShow", UpdatePartyFrames)
|
||||||
ShaguTweaks.HookScript(raid, "OnHide", UpdatePartyFrames)
|
ShaguTweaks.HookScript(raid, "OnHide", UpdatePartyFrames)
|
||||||
|
ShaguTweaks.HookScript(raid.cluster, "OnShow", UpdatePartyFrames)
|
||||||
|
ShaguTweaks.HookScript(raid.cluster, "OnHide", UpdatePartyFrames)
|
||||||
|
|
||||||
local watcher = CreateFrame("Frame", nil, UIParent)
|
local watcher = CreateFrame("Frame", nil, UIParent)
|
||||||
watcher:RegisterEvent("PLAYER_ENTERING_WORLD")
|
watcher:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
watcher:RegisterEvent("RAID_ROSTER_UPDATE")
|
watcher:RegisterEvent("RAID_ROSTER_UPDATE")
|
||||||
watcher:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
watcher:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
||||||
watcher:SetScript("OnEvent", UpdatePartyFrames)
|
watcher:SetScript("OnEvent", UpdatePartyFrames)
|
||||||
|
|
||||||
UpdatePartyFrames()
|
UpdatePartyFrames()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
+38
-37
@@ -11,52 +11,53 @@ local module = ShaguTweaks:register({
|
|||||||
})
|
})
|
||||||
|
|
||||||
module.enable = function(self)
|
module.enable = function(self)
|
||||||
local raid = ShaguTweaksRaidFrame
|
if not ShaguTweaks.RaidFrame_OnReady then return end
|
||||||
if not raid then return end
|
|
||||||
|
|
||||||
local RaidOnEvent = raid:GetScript("OnEvent")
|
ShaguTweaks.RaidFrame_OnReady(function(raid)
|
||||||
raid:RegisterEvent("PARTY_LEADER_CHANGED")
|
local RaidOnEvent = raid:GetScript("OnEvent")
|
||||||
raid:RegisterEvent("PARTY_LOOT_METHOD_CHANGED")
|
raid:RegisterEvent("PARTY_LEADER_CHANGED")
|
||||||
raid:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
raid:RegisterEvent("PARTY_LOOT_METHOD_CHANGED")
|
||||||
|
raid:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
||||||
|
|
||||||
raid:SetScript("OnEvent", function()
|
raid:SetScript("OnEvent", function()
|
||||||
-- run default scripts
|
-- run default scripts
|
||||||
if RaidOnEvent then RaidOnEvent() end
|
if RaidOnEvent then RaidOnEvent() end
|
||||||
|
|
||||||
-- break here in normal raid scenario
|
-- break here in normal raid scenario
|
||||||
if UnitInRaid("player") then return end
|
if UnitInRaid("player") then return end
|
||||||
|
|
||||||
-- check for party mode
|
-- check for party mode
|
||||||
if GetNumPartyMembers() > 0 then
|
if GetNumPartyMembers() > 0 then
|
||||||
-- initialize raid frame
|
-- initialize raid frame
|
||||||
local x, y = 1, 0
|
local x, y = 1, 0
|
||||||
for index = 1, 40 do
|
for index = 1, 40 do
|
||||||
-- clear current unitstr assignments
|
-- clear current unitstr assignments
|
||||||
this.cluster.frames[index].unitstr = nil
|
this.cluster.frames[index].unitstr = nil
|
||||||
this.cluster.frames[index]:Hide()
|
this.cluster.frames[index]:Hide()
|
||||||
|
|
||||||
if index <= 5 then
|
if index <= 5 then
|
||||||
-- determine best unitstr
|
-- determine best unitstr
|
||||||
local unitstr = index == 1 and "player" or "party" .. index-1
|
local unitstr = index == 1 and "player" or "party" .. index-1
|
||||||
|
|
||||||
-- assign party to first raid group of frames
|
-- assign party to first raid group of frames
|
||||||
this.cluster.frames[index].unitstr = unitstr
|
this.cluster.frames[index].unitstr = unitstr
|
||||||
this.cluster.frames[index].groupid = 1
|
this.cluster.frames[index].groupid = 1
|
||||||
this.cluster.frames[index]:Show()
|
this.cluster.frames[index]:Show()
|
||||||
|
|
||||||
-- save required raid frame size
|
-- save required raid frame size
|
||||||
if UnitExists(unitstr) then
|
if UnitExists(unitstr) then
|
||||||
y = math.max(y, index)
|
y = math.max(y, index)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
-- set raid frame size
|
-- set raid frame size
|
||||||
raid.cluster:SetWidth(x * (raid.cluster.config["raid.width"]+2) + 6)
|
raid.cluster:SetWidth(x * (raid.cluster.config["raid.width"]+2) + 6)
|
||||||
raid.cluster:SetHeight(y * (raid.cluster.config["raid.height"]+1) + 7)
|
raid.cluster:SetHeight(y * (raid.cluster.config["raid.height"]+1) + 7)
|
||||||
raid:Show()
|
raid:Show()
|
||||||
else
|
else
|
||||||
raid:Hide()
|
raid:Hide()
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
+36
-8
@@ -18,6 +18,32 @@ local module = ShaguTweaks:register({
|
|||||||
})
|
})
|
||||||
|
|
||||||
local components = {}
|
local components = {}
|
||||||
|
local raidReadyCallbacks = {}
|
||||||
|
local raidReadyFrame
|
||||||
|
|
||||||
|
-- Raid submodules are enabled from an unordered ShaguTweaks.mods table.
|
||||||
|
-- Queue work that needs the actual raid frame so submodules never depend on
|
||||||
|
-- which module happens to be visited first by pairs().
|
||||||
|
ShaguTweaks.RaidFrame_OnReady = function(callback)
|
||||||
|
if type(callback) ~= "function" then return end
|
||||||
|
|
||||||
|
if raidReadyFrame then
|
||||||
|
callback(raidReadyFrame)
|
||||||
|
else
|
||||||
|
table.insert(raidReadyCallbacks, callback)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function NotifyRaidFrameReady(raid)
|
||||||
|
raidReadyFrame = raid
|
||||||
|
|
||||||
|
local callbacks = raidReadyCallbacks
|
||||||
|
raidReadyCallbacks = {}
|
||||||
|
|
||||||
|
for i = 1, table.getn(callbacks) do
|
||||||
|
callbacks[i](raid)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local backdrop = {
|
local backdrop = {
|
||||||
border = {
|
border = {
|
||||||
@@ -134,7 +160,7 @@ local UnitFrame_OnEvent = function()
|
|||||||
if not this.events[event] then return end
|
if not this.events[event] then return end
|
||||||
|
|
||||||
-- run update functions for each frame
|
-- run update functions for each frame
|
||||||
for id, component in pairs(this.events[event]) do
|
for _, component in ipairs(this.events[event]) do
|
||||||
component.update(this, event)
|
component.update(this, event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -170,12 +196,12 @@ local CreateUnitFrame = function(parent, i)
|
|||||||
frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
frame:RegisterEvent("PARTY_MEMBERS_CHANGED")
|
||||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
|
|
||||||
for id, object in pairs(components) do
|
for _, object in ipairs(components) do
|
||||||
-- create component frames
|
-- create component frames
|
||||||
object.create(frame)
|
object.create(frame)
|
||||||
|
|
||||||
-- register component update events
|
-- register component update events
|
||||||
for _, event in pairs(object.events) do
|
for _, event in ipairs(object.events) do
|
||||||
frame:RegisterEvent(event)
|
frame:RegisterEvent(event)
|
||||||
frame.events[event] = frame.events[event] or {}
|
frame.events[event] = frame.events[event] or {}
|
||||||
table.insert(frame.events[event], object)
|
table.insert(frame.events[event], object)
|
||||||
@@ -225,7 +251,7 @@ UnitFrame_NewComponent('health', {
|
|||||||
update = function(frame, event)
|
update = function(frame, event)
|
||||||
-- ignore empty or unrelated events
|
-- ignore empty or unrelated events
|
||||||
if not event then return end
|
if not event then return end
|
||||||
if arg1 and this.unitstr ~= arg1 then return end
|
if arg1 and frame.unitstr ~= arg1 then return end
|
||||||
|
|
||||||
-- update statusbar values
|
-- update statusbar values
|
||||||
frame.bar:SetMinMaxValues(0, UnitHealthMax(frame.unitstr))
|
frame.bar:SetMinMaxValues(0, UnitHealthMax(frame.unitstr))
|
||||||
@@ -269,7 +295,7 @@ UnitFrame_NewComponent('mana', {
|
|||||||
update = function(frame, event)
|
update = function(frame, event)
|
||||||
-- ignore empty or unrelated events
|
-- ignore empty or unrelated events
|
||||||
if not event then return end
|
if not event then return end
|
||||||
if arg1 and this.unitstr ~= arg1 then return end
|
if arg1 and frame.unitstr ~= arg1 then return end
|
||||||
|
|
||||||
-- update mana bar values
|
-- update mana bar values
|
||||||
frame.mana:SetMinMaxValues(0, UnitManaMax(frame.unitstr))
|
frame.mana:SetMinMaxValues(0, UnitManaMax(frame.unitstr))
|
||||||
@@ -484,7 +510,7 @@ module.enable = function(self)
|
|||||||
local x, y = 0, 0
|
local x, y = 0, 0
|
||||||
for group = 1, 8 do
|
for group = 1, 8 do
|
||||||
if RAID_SUBGROUP_LISTS and RAID_SUBGROUP_LISTS[group] then
|
if RAID_SUBGROUP_LISTS and RAID_SUBGROUP_LISTS[group] then
|
||||||
for id, unit in pairs(RAID_SUBGROUP_LISTS[group]) do
|
for id, unit in ipairs(RAID_SUBGROUP_LISTS[group]) do
|
||||||
-- assign proper unitstrs to frames
|
-- assign proper unitstrs to frames
|
||||||
local index = (group - 1) * 5 + id
|
local index = (group - 1) * 5 + id
|
||||||
local frame = this.cluster.frames[index]
|
local frame = this.cluster.frames[index]
|
||||||
@@ -612,11 +638,11 @@ module.enable = function(self)
|
|||||||
|
|
||||||
if not raid.cluster.frames then return end
|
if not raid.cluster.frames then return end
|
||||||
|
|
||||||
for _, frame in pairs(raid.cluster.frames) do
|
for _, frame in ipairs(raid.cluster.frames) do
|
||||||
if frame:IsVisible() and frame.unitstr and UnitName(frame.unitstr) then
|
if frame:IsVisible() and frame.unitstr and UnitName(frame.unitstr) then
|
||||||
local tickers = frame.events['FRAME_TICK_250']
|
local tickers = frame.events['FRAME_TICK_250']
|
||||||
if tickers then
|
if tickers then
|
||||||
for _, component in pairs(tickers) do
|
for _, component in ipairs(tickers) do
|
||||||
component.update(frame, 'FRAME_TICK_250')
|
component.update(frame, 'FRAME_TICK_250')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -624,4 +650,6 @@ module.enable = function(self)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
NotifyRaidFrameReady(raid)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,8 +15,16 @@ local module = ShaguTweaks:register({
|
|||||||
})
|
})
|
||||||
|
|
||||||
module.enable = function(self)
|
module.enable = function(self)
|
||||||
-- only run if reduced actionbar is enabled
|
-- The ShaguTweaks loader initializes module config while iterating an
|
||||||
if ShaguTweaks_config[T["Reduced Actionbar Size"]] == 0 then return end
|
-- unordered table. On a fresh install the Reduced Actionbar key may not have
|
||||||
|
-- been visited yet, so fall back to that module's declared default.
|
||||||
|
local reducedTitle = T["Reduced Actionbar Size"]
|
||||||
|
local reducedEnabled = ShaguTweaks_config and ShaguTweaks_config[reducedTitle]
|
||||||
|
if reducedEnabled == nil then
|
||||||
|
local reducedModule = ShaguTweaks.mods and ShaguTweaks.mods[reducedTitle]
|
||||||
|
reducedEnabled = reducedModule and reducedModule.enabled and 1 or 0
|
||||||
|
end
|
||||||
|
if reducedEnabled ~= 1 then return end
|
||||||
|
|
||||||
local frames = {
|
local frames = {
|
||||||
KeyRingButton, CharacterBag3Slot, CharacterBag2Slot, CharacterBag1Slot,
|
KeyRingButton, CharacterBag3Slot, CharacterBag2Slot, CharacterBag1Slot,
|
||||||
@@ -71,7 +79,7 @@ module.enable = function(self)
|
|||||||
if not this.mousedisabled then
|
if not this.mousedisabled then
|
||||||
-- disable mouse events on all frames
|
-- disable mouse events on all frames
|
||||||
this.mousedisabled = true
|
this.mousedisabled = true
|
||||||
for _, frame in pairs(frames) do
|
for _, frame in ipairs(frames) do
|
||||||
frame:EnableMouse(0)
|
frame:EnableMouse(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -79,7 +87,7 @@ module.enable = function(self)
|
|||||||
if this.mousedisabled then
|
if this.mousedisabled then
|
||||||
-- enable all mouse events again
|
-- enable all mouse events again
|
||||||
this.mousedisabled = false
|
this.mousedisabled = false
|
||||||
for _, frame in pairs(frames) do
|
for _, frame in ipairs(frames) do
|
||||||
frame:EnableMouse(1)
|
frame:EnableMouse(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -92,7 +100,7 @@ module.enable = function(self)
|
|||||||
|
|
||||||
ShaguTweaks.DarkenFrame(bagframe)
|
ShaguTweaks.DarkenFrame(bagframe)
|
||||||
|
|
||||||
for id, frame in pairs(frames) do
|
for id, frame in ipairs(frames) do
|
||||||
local anchor = frames[id-1] or bagframe
|
local anchor = frames[id-1] or bagframe
|
||||||
frame:ClearAllPoints()
|
frame:ClearAllPoints()
|
||||||
frame:SetPoint("LEFT", anchor, id == 1 and "LEFT" or "RIGHT", id == 1 and 5 or 2, 0)
|
frame:SetPoint("LEFT", anchor, id == 1 and "LEFT" or "RIGHT", id == 1 and 5 or 2, 0)
|
||||||
|
|||||||
@@ -15,8 +15,16 @@ local module = ShaguTweaks:register({
|
|||||||
})
|
})
|
||||||
|
|
||||||
module.enable = function(self)
|
module.enable = function(self)
|
||||||
-- only run if reduced actionbar is enabled
|
-- The ShaguTweaks loader initializes module config while iterating an
|
||||||
if ShaguTweaks_config[T["Reduced Actionbar Size"]] == 0 then return end
|
-- unordered table. On a fresh install the Reduced Actionbar key may not have
|
||||||
|
-- been visited yet, so fall back to that module's declared default.
|
||||||
|
local reducedTitle = T["Reduced Actionbar Size"]
|
||||||
|
local reducedEnabled = ShaguTweaks_config and ShaguTweaks_config[reducedTitle]
|
||||||
|
if reducedEnabled == nil then
|
||||||
|
local reducedModule = ShaguTweaks.mods and ShaguTweaks.mods[reducedTitle]
|
||||||
|
reducedEnabled = reducedModule and reducedModule.enabled and 1 or 0
|
||||||
|
end
|
||||||
|
if reducedEnabled ~= 1 then return end
|
||||||
|
|
||||||
local frames = {
|
local frames = {
|
||||||
CharacterMicroButton, SpellbookMicroButton, TalentMicroButton,
|
CharacterMicroButton, SpellbookMicroButton, TalentMicroButton,
|
||||||
@@ -72,7 +80,7 @@ module.enable = function(self)
|
|||||||
if not this.mousedisabled then
|
if not this.mousedisabled then
|
||||||
-- disable mouse events on all frames
|
-- disable mouse events on all frames
|
||||||
this.mousedisabled = true
|
this.mousedisabled = true
|
||||||
for _, frame in pairs(frames) do
|
for _, frame in ipairs(frames) do
|
||||||
frame:EnableMouse(0)
|
frame:EnableMouse(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -80,7 +88,7 @@ module.enable = function(self)
|
|||||||
if this.mousedisabled then
|
if this.mousedisabled then
|
||||||
-- enable all mouse events again
|
-- enable all mouse events again
|
||||||
this.mousedisabled = false
|
this.mousedisabled = false
|
||||||
for _, frame in pairs(frames) do
|
for _, frame in ipairs(frames) do
|
||||||
frame:EnableMouse(1)
|
frame:EnableMouse(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -93,7 +101,7 @@ module.enable = function(self)
|
|||||||
|
|
||||||
ShaguTweaks.DarkenFrame(microframe)
|
ShaguTweaks.DarkenFrame(microframe)
|
||||||
|
|
||||||
for id, frame in pairs(frames) do
|
for id, frame in ipairs(frames) do
|
||||||
local anchor = frames[id-1] or microframe
|
local anchor = frames[id-1] or microframe
|
||||||
frame:ClearAllPoints()
|
frame:ClearAllPoints()
|
||||||
frame:SetPoint("LEFT", anchor, id == 1 and "LEFT" or "RIGHT", id == 1 and 3.5 or -2, id==1 and 10 or 0)
|
frame:SetPoint("LEFT", anchor, id == 1 and "LEFT" or "RIGHT", id == 1 and 3.5 or -2, id==1 and 10 or 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user