Skip to content

Commit

Permalink
Readd fading for pet, tot, and tof frames
Browse files Browse the repository at this point in the history
Ref: #76
  • Loading branch information
ls- committed May 7, 2023
1 parent 0c41b4a commit df7669b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 101 deletions.
33 changes: 33 additions & 0 deletions ls_UI/core/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,17 @@ D.profile = {
width = 114,
height = 28,
point = {"BOTTOMRIGHT", "LSPlayerFrame", "BOTTOMLEFT", -12, 0},
fade = {
enabled = false,
combat = false,
target = false,
health = false,
out_delay = 0.75,
out_duration = 0.15,
in_duration = 0.15,
min_alpha = 0.2,
max_alpha = 1,
},
insets = {
t_size = 0.25,
b_size = 0.25,
Expand Down Expand Up @@ -1191,6 +1202,17 @@ D.profile = {
width = 114,
height = 28,
point = {"BOTTOMLEFT", "LSTargetFrame", "BOTTOMRIGHT", 12, 0},
fade = {
enabled = false,
combat = false,
target = false,
health = false,
out_delay = 0.75,
out_duration = 0.15,
in_duration = 0.15,
min_alpha = 0.2,
max_alpha = 1,
},
insets = {
t_size = 0.25,
b_size = 0.25,
Expand Down Expand Up @@ -1524,6 +1546,17 @@ D.profile = {
width = 114,
height = 28,
point = {"BOTTOMLEFT", "LSFocusFrame", "BOTTOMRIGHT", 12, 0},
fade = {
enabled = false,
combat = false,
target = false,
health = false,
out_delay = 0.75,
out_duration = 0.15,
in_duration = 0.15,
min_alpha = 0.2,
max_alpha = 1,
},
insets = {
t_size = 0.25,
b_size = 0.25,
Expand Down
13 changes: 0 additions & 13 deletions ls_UI/core/modernize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -776,19 +776,6 @@ function P:Modernize(data, name, key)
data.version = 10000501
end

--> 100005.03
if data.version < 10000503 then
if data.units then
for _, unit in next, {"pet", "focustarget", "targettarget"} do
if data.units[unit] then
data.units[unit].fade = nil
end
end
end

data.version = 10000503
end

--> 100100.01
if data.version < 10010001 then
if data.blizzard then
Expand Down
11 changes: 0 additions & 11 deletions ls_UI/modules/unitframes/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,10 @@ local configIgnoredKeys = {
threat = true,
}

local parentUnits = {
["pet"] = "player",
["focustarget"] = "focus",
["targettarget"] = "target",
}

local frame_proto = {}

function frame_proto:UpdateConfig()
self._config = E:CopyTable(C.db.profile.units[self.__unit], self._config, configIgnoredKeys)

local parentUnit = parentUnits[self.__unit]
if parentUnit then
self._config.fade = E:CopyTable(C.db.profile.units[parentUnit].fade, self._config.fade)
end
end

function frame_proto:OnEnter()
Expand Down
21 changes: 0 additions & 21 deletions ls_UI_Options/unitframes/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,6 @@ local function getUnitFrameOptions(order, unit, name)

if unit == "player" then
temp.disabled = isPlayerFrameDisabled
temp.args.reset.func = function()
CONFIG:CopySettings(D.profile.units.player, C.db.profile.units.player)
UNITFRAMES:For("player", "Update")
UNITFRAMES:For("pet", "UpdateConfig")
UNITFRAMES:For("pet", "UpdateFading")
end
temp.args.class_power = CONFIG:CreateUnitFrameClassPowerOptions(33, unit)
temp.args.castbar = CONFIG:CreateUnitFrameCastbarOptions(34, unit)
temp.args.custom_texts = CONFIG:CreateUnitFrameCustomTextsOptions(40, unit)
Expand All @@ -279,15 +273,8 @@ local function getUnitFrameOptions(order, unit, name)
temp.args.pvp = nil
temp.args.status = nil
temp.args.mirror_widgets = nil
temp.args.fading = nil
elseif unit == "target" then
temp.disabled = isTargetFrameDisabled
temp.args.reset.func = function()
CONFIG:CopySettings(D.profile.units.target, C.db.profile.units.target)
UNITFRAMES:For("target", "Update")
UNITFRAMES:For("targettarget", "UpdateConfig")
UNITFRAMES:For("targettarget", "UpdateFading")
end
temp.args.castbar = CONFIG:CreateUnitFrameCastbarOptions(34, unit)
temp.args.auras = CONFIG:CreateUnitFrameAurasOptions(35, unit)
temp.args.custom_texts = CONFIG:CreateUnitFrameCustomTextsOptions(40, unit)
Expand All @@ -296,15 +283,8 @@ local function getUnitFrameOptions(order, unit, name)
temp.args.debuff = nil
temp.args.pvp = nil
temp.args.mirror_widgets = nil
temp.args.fading = nil
elseif unit == "focus" then
temp.disabled = isFocusFrameDisabled
temp.args.reset.func = function()
CONFIG:CopySettings(D.profile.units.focus, C.db.profile.units.focus)
UNITFRAMES:For("focus", "Update")
UNITFRAMES:For("focustarget", "UpdateConfig")
UNITFRAMES:For("focustarget", "UpdateFading")
end
temp.args.castbar = CONFIG:CreateUnitFrameCastbarOptions(34, unit)
temp.args.auras = CONFIG:CreateUnitFrameAurasOptions(35, unit)
temp.args.custom_texts = CONFIG:CreateUnitFrameCustomTextsOptions(40, unit)
Expand All @@ -313,7 +293,6 @@ local function getUnitFrameOptions(order, unit, name)
temp.args.debuff = nil
temp.args.pvp = nil
temp.args.mirror_widgets = nil
temp.args.fading = nil
elseif unit == "boss" then
temp.disabled = isBossFrameDisabled
temp.args.alt_power = CONFIG:CreateUnitFrameAltPowerOptions(33, unit)
Expand Down
57 changes: 1 addition & 56 deletions ls_UI_Options/unitframes/fading.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local function isFadingDisabled(info)
end

function CONFIG:CreateUnitFrameFadingOptions(order, unit)
local temp = {
return {
order = order,
type = "group",
name = L["FADING"],
Expand Down Expand Up @@ -117,59 +117,4 @@ function CONFIG:CreateUnitFrameFadingOptions(order, unit)
},
},
}

if unit == "player" then
temp.set = function(info, value)
C.db.profile.units.player.fade[info[#info]] = value

UNITFRAMES:For("player", "UpdateConfig")
UNITFRAMES:For("player", "UpdateFading")
UNITFRAMES:For("pet", "UpdateConfig")
UNITFRAMES:For("pet", "UpdateFading")
end

temp.args.reset.func = function()
CONFIG:CopySettings(D.profile.units.player.fade, C.db.profile.units.player.fade, {enabled = true})
UNITFRAMES:For("player", "UpdateConfig")
UNITFRAMES:For("player", "UpdateFading")
UNITFRAMES:For("pet", "UpdateConfig")
UNITFRAMES:For("pet", "UpdateFading")
end
elseif unit == "focus" then
temp.set = function(info, value)
C.db.profile.units.focus.fade[info[#info]] = value

UNITFRAMES:For("focus", "UpdateConfig")
UNITFRAMES:For("focus", "UpdateFading")
UNITFRAMES:For("focustarget", "UpdateConfig")
UNITFRAMES:For("focustarget", "UpdateFading")
end

temp.args.reset.func = function()
CONFIG:CopySettings(D.profile.units.focus.fade, C.db.profile.units.focus.fade, {enabled = true})
UNITFRAMES:For("focus", "UpdateConfig")
UNITFRAMES:For("focus", "UpdateFading")
UNITFRAMES:For("focustarget", "UpdateConfig")
UNITFRAMES:For("focustarget", "UpdateFading")
end
elseif unit == "target" then
temp.set = function(info, value)
C.db.profile.units.target.fade[info[#info]] = value

UNITFRAMES:For("target", "UpdateConfig")
UNITFRAMES:For("target", "UpdateFading")
UNITFRAMES:For("targettarget", "UpdateConfig")
UNITFRAMES:For("targettarget", "UpdateFading")
end

temp.args.reset.func = function()
CONFIG:CopySettings(D.profile.units.target.fade, C.db.profile.units.target.fade, {enabled = true})
UNITFRAMES:For("target", "UpdateConfig")
UNITFRAMES:For("target", "UpdateFading")
UNITFRAMES:For("targettarget", "UpdateConfig")
UNITFRAMES:For("targettarget", "UpdateFading")
end
end

return temp
end

0 comments on commit df7669b

Please sign in to comment.