#31 frames expand a centric point option added

This commit is contained in:
Sumsebrum 2022-03-25 16:36:27 +01:00
parent 5b32b8c793
commit eddd7588f4
2 changed files with 15 additions and 3 deletions

View File

@ -134,6 +134,8 @@ function Gladdy:UpdateFrame()
local height = (self.db.healthBarHeight + powerBarHeight) * teamSize local height = (self.db.healthBarHeight + powerBarHeight) * teamSize
+ (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize) + (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize)
+ self.db.bottomMargin * (teamSize - 1) + self.db.bottomMargin * (teamSize - 1)
local singleFrameHeight = self.db.healthBarHeight + powerBarHeight +
(self.db.highlightInset and 0 or self.db.highlightBorderSize * 2) + self.db.bottomMargin
-- Highlight -- Highlight
margin = margin + highlightBorderSize margin = margin + highlightBorderSize
@ -155,10 +157,13 @@ function Gladdy:UpdateFrame()
self.frame:SetPoint("CENTER") self.frame:SetPoint("CENTER")
else else
local scale = self.frame:GetEffectiveScale() local scale = self.frame:GetEffectiveScale()
local growMiddle = self.db.growMiddle and teamSize > 0 and teamSize / 2 >= 1 and (teamSize - 1) * (singleFrameHeight / 2) or 0
if (self.db.growDirection == "TOP") then if (self.db.growDirection == "TOP") then
self.frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale) self.frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, (self.db.y / scale) - growMiddle)
elseif self.db.growDirection == "BOTTOM" then
self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, (self.db.y / scale) + growMiddle)
else else
self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale) self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, (self.db.y / scale))
end end
end end

View File

@ -48,6 +48,7 @@ Gladdy.defaults = {
x = 0, x = 0,
y = 0, y = 0,
growDirection = "BOTTOM", growDirection = "BOTTOM",
growMiddle = false,
frameScale = 1, frameScale = 1,
pixelPerfect = false, pixelPerfect = false,
barWidth = 180, barWidth = 180,
@ -311,7 +312,7 @@ function Gladdy:SetupOptions()
group = { group = {
type = "group", type = "group",
name = L["General"], name = L["General"],
order = 5, order = 6,
childGroups = "tree", childGroups = "tree",
args = { args = {
frameGeneral = { frameGeneral = {
@ -322,6 +323,12 @@ function Gladdy:SetupOptions()
headerFrame = { headerFrame = {
type = "header", type = "header",
name = L["Frame General"], name = L["Frame General"],
order = 2,
},
growMiddle = {
type = "toggle",
name = L["Grow Middle"],
desc = L["Frames expand along a centric anchor"],
order = 3, order = 3,
}, },
pixelPerfect = { pixelPerfect = {