Skip to content

Commit

Permalink
#18: Support Left Align and Right Align
Browse files Browse the repository at this point in the history
  • Loading branch information
Mctalian committed Aug 16, 2024
1 parent ae6f311 commit 529c638
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 21 deletions.
47 changes: 32 additions & 15 deletions ConfigOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ G_RLF.defaults = {
global = {
relativePoint = "UIParent",
anchorPoint = "BOTTOMLEFT",
leftAlign = true,
xOffset = 720,
yOffset = 375,
feedWidth = 330,
Expand Down Expand Up @@ -121,11 +122,19 @@ G_RLF.options = {
set = "SetYOffset",
order = 4
},
sizing = {
rowFormat = {
type = "header",
name = "Sizing",
name = "Row Format",
order = 5
},
leftAlign = {
type = "toggle",
name = "Left Align",
desc = "Left align row content (right align if unchecked)",
get = "GetLeftAlign",
set = "SetLeftAlign",
order = 6,
},
feedWidth = {
type = "range",
name = "Feed Width",
Expand All @@ -134,7 +143,7 @@ G_RLF.options = {
max = 1000,
get = "GetFeedWidth",
set = "SetFeedWidth",
order = 6
order = 7
},
maxRows = {
type = "range",
Expand All @@ -146,7 +155,7 @@ G_RLF.options = {
bigStep = 5,
get = "GetMaxRows",
set = "SetMaxRows",
order = 6
order = 8
},
rowHeight = {
type = "range",
Expand All @@ -156,7 +165,7 @@ G_RLF.options = {
max = 100,
get = "GetRowHeight",
set = "SetRowHeight",
order = 7
order = 9
},
iconSize = {
type = "range",
Expand All @@ -166,7 +175,7 @@ G_RLF.options = {
max = 100,
get = "GetIconSize",
set = "SetIconSize",
order = 8
order = 10
},
rowPadding = {
type = "range",
Expand All @@ -176,12 +185,12 @@ G_RLF.options = {
max = 10,
get = "GetRowPadding",
set = "SetRowPadding",
order = 9
order = 11
},
timing = {
type = "header",
name = "Timing",
order = 10
order = 12
},
fadeOutDelay = {
type = "range",
Expand All @@ -191,30 +200,30 @@ G_RLF.options = {
max = 30,
get = "GetFadeOutDelay",
set = "SetFadeOutDelay",
order = 11
order = 13
},
styles = {
type = "header",
name = "Row Styling",
order = 12
order = 14
},
gradientStart = {
type = "color",
name = "Background Gradient start",
desc = "The 'left' color of the row background gradient.",
desc = "The start color of the row background gradient.",
hasAlpha = true,
get = "GetGradientStartColor",
set = "SetGradientStartColor",
order = 13
order = 15
},
gradientEnd = {
type = "color",
name = "Background Gradient end",
desc = "The 'right' color of the row background gradient.",
desc = "The end color of the row background gradient.",
hasAlpha = true,
get = "GetGradientEndColor",
set = "SetGradientEndColor",
order = 14
order = 16
}
}
},
Expand Down Expand Up @@ -336,7 +345,6 @@ function ConfigOptions:SetGradientEndColor(info, r, g, b, a)
G_RLF.db.global.rowBackgroundGradientEnd = { r, g, b, a }
end


function ConfigOptions:SetFadeOutDelay(info, value)
G_RLF.db.global.fadeOutDelay = value
G_RLF.LootDisplay:UpdateFadeDelay()
Expand All @@ -354,6 +362,15 @@ function ConfigOptions:GetDisableLootToast(info, value)
return G_RLF.db.global.disableBlizzLootToasts
end

function ConfigOptions:SetLeftAlign(info, value)
G_RLF.db.global.leftAlign = value
G_RLF.LootDisplay:UpdateRowStyles()
end

function ConfigOptions:GetLeftAlign(info, value)
return G_RLF.db.global.leftAlign
end

function ConfigOptions:ToggleBoundingBox()
G_RLF.LootDisplay:ToggleBoundingBox()
end
Expand Down
41 changes: 35 additions & 6 deletions LootDisplay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,13 @@ rowBackground = function(row)
row.background:ClearAllPoints()
end
row.background:SetTexture("Interface/Buttons/WHITE8x8")
row.background:SetGradient("HORIZONTAL", CreateColor(unpack(config.rowBackgroundGradientStart)),
CreateColor(unpack(config.rowBackgroundGradientEnd)))
local leftColor = CreateColor(unpack(config.rowBackgroundGradientStart))
local rightColor = CreateColor(unpack(config.rowBackgroundGradientEnd))
if G_RLF.db.global.leftAlign == false then
leftColor = CreateColor(unpack(config.rowBackgroundGradientEnd))
rightColor = CreateColor(unpack(config.rowBackgroundGradientStart))
end
row.background:SetGradient("HORIZONTAL", leftColor, rightColor)
row.background:SetAllPoints()
end

Expand All @@ -206,7 +211,13 @@ rowIcon = function(row)
row.icon:ClearAllPoints()
end
row.icon:SetSize(config.iconSize, config.iconSize)
row.icon:SetPoint("LEFT", config.iconSize / 4, 0)
local anchor = "LEFT"
local xOffset = config.iconSize / 4
if G_RLF.db.global.leftAlign == false then
anchor = "RIGHT"
xOffset = xOffset * -1
end
row.icon:SetPoint(anchor, xOffset, 0)
row.icon:Show()
end

Expand All @@ -218,7 +229,13 @@ rowMoneyIcon = function(row)
row.icon:SetTexture(nil)
end
row.icon:SetSize(config.iconSize, config.iconSize)
row.icon:SetPoint("LEFT", config.iconSize / 4, 0)
local anchor = "LEFT"
local xOffset = config.iconSize / 4
if G_RLF.db.global.leftAlign == false then
anchor = "RIGHT"
xOffset = xOffset * -1
end
row.icon:SetPoint(anchor, xOffset, 0)
row.icon:Hide()
end

Expand All @@ -228,7 +245,11 @@ rowMoneyText = function(row)
else
row.amountText:ClearAllPoints()
end
row.amountText:SetPoint("LEFT", row.icon, "LEFT", 0, 0)
local anchor = "LEFT"
if G_RLF.db.global.leftAlign == false then
anchor = "RIGHT"
end
row.amountText:SetPoint(anchor, row.icon, anchor, 0, 0)
end

rowAmountText = function(row)
Expand All @@ -237,7 +258,15 @@ rowAmountText = function(row)
else
row.amountText:ClearAllPoints()
end
row.amountText:SetPoint("LEFT", row.icon, "RIGHT", config.iconSize / 2, 0)
local anchor = "LEFT"
local iconAnchor = "RIGHT"
local xOffset = config.iconSize / 2
if G_RLF.db.global.leftAlign == false then
anchor = "RIGHT"
iconAnchor = "LEFT"
xOffset = xOffset * -1
end
row.amountText:SetPoint(anchor, row.icon, iconAnchor, xOffset, 0)
end

rowFadeOutAnimation = function(row)
Expand Down

0 comments on commit 529c638

Please sign in to comment.