highlight inset option added

This commit is contained in:
Sumsebrum 2021-05-22 13:41:31 +02:00
parent ded321e772
commit 0c6cae0b04
10 changed files with 166 additions and 77 deletions

117
Frame.lua
View File

@ -30,6 +30,9 @@ Gladdy.BUTTON_DEFAULTS = {
function Gladdy:CreateFrame() function Gladdy:CreateFrame()
self.frame = CreateFrame("Frame", "GladdyFrame", UIParent) self.frame = CreateFrame("Frame", "GladdyFrame", UIParent)
--self.frame.texture = self.frame:CreateTexture(nil, "OVERLAY")
--self.frame.texture:SetAllPoints(self.frame)
--self.frame.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
self.frame:SetClampedToScreen(true) self.frame:SetClampedToScreen(true)
self.frame:EnableMouse(false) self.frame:EnableMouse(false)
@ -109,48 +112,69 @@ function Gladdy:UpdateFrame()
end end
local teamSize = self.curBracket or 0 local teamSize = self.curBracket or 0
local iconSize = self.db.healthBarHeight local highlightBorderSize = (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2)
local margin = 0 local leftSize = 0
local width = self.db.barWidth + self.db.padding * 2 + 5 local rightSize = 0
local height = self.db.healthBarHeight * teamSize + margin * (teamSize - 1) + self.db.padding * 2 + 5 --Trinket + Racial
local extraBarWidth = 0 if self.db.trinketEnabled and self.db.trinketPos == "LEFT" then
local extraBarHeight = 0 leftSize = leftSize + self.db.trinketSize * self.db.trinketWidthFactor + self.db.padding
if self.db.racialEnabled and self.db.racialAnchor == "trinket" and self.db.racialPos == "LEFT" then
leftSize = leftSize + self.db.racialSize * self.db.racialWidthFactor + self.db.padding
end
end
if self.db.trinketEnabled and self.db.trinketPos == "RIGHT" then
rightSize = rightSize + self.db.trinketSize * self.db.trinketWidthFactor + self.db.padding
if self.db.racialEnabled and self.db.racialAnchor == "trinket" and self.db.racialPos == "RIGHT" then
rightSize = rightSize + self.db.racialSize * self.db.racialWidthFactor + self.db.padding
end
end
--ClassIcon
if self.db.classIconPos == "LEFT" then
leftSize = leftSize + self.db.classIconSize * self.db.classIconWidthFactor + self.db.padding
else
rightSize = rightSize + self.db.classIconSize * self.db.classIconWidthFactor + self.db.padding
end
--Highlight
if not self.db.highlightInset then
leftSize = leftSize + self.db.highlightBorderSize
rightSize = rightSize + self.db.highlightBorderSize
end
-- Powerbar local margin = self.db.powerBarHeight + 1
iconSize = iconSize + self.db.powerBarHeight local width = self.db.barWidth + leftSize + rightSize
margin = margin + self.db.powerBarHeight local height = (self.db.healthBarHeight + self.db.powerBarHeight + 1) * teamSize
height = height + self.db.powerBarHeight * teamSize + (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize)
extraBarHeight = extraBarHeight + self.db.powerBarHeight + self.db.bottomMargin * (teamSize - 1)
-- Cooldown -- Highlight
margin = margin + 1 + self.db.highlightBorderSize * 2 + 1 -- + 1 space between health and power bar margin = margin + highlightBorderSize
height = height + self.db.highlightBorderSize * teamSize
if (self.db.cooldownYPos == "TOP" or self.db.cooldownYPos == "BOTTOM") and self.db.cooldown then if (self.db.cooldownYPos == "TOP" or self.db.cooldownYPos == "BOTTOM") and self.db.cooldown then
margin = margin + self.db.cooldownSize margin = margin + self.db.cooldownSize
height = height + self.db.cooldownSize * teamSize height = height + self.db.cooldownSize * (teamSize - 1)
end end
if (self.db.buffsCooldownPos == "TOP" or self.db.buffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then if (self.db.buffsCooldownPos == "TOP" or self.db.buffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
margin = margin + self.db.buffsIconSize margin = margin + self.db.buffsIconSize
height = height + self.db.buffsIconSize * teamSize height = height + self.db.buffsIconSize * (teamSize - 1)
end end
if (self.db.buffsBuffsCooldownPos == "TOP" or self.db.buffsBuffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then if (self.db.buffsBuffsCooldownPos == "TOP" or self.db.buffsBuffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
margin = margin + self.db.buffsBuffsIconSize margin = margin + self.db.buffsBuffsIconSize
height = height + self.db.buffsBuffsIconSize * teamSize height = height + self.db.buffsBuffsIconSize * (teamSize - 1)
end end
if self.db.buffsCooldownPos == "TOP" and self.db.cooldownYPos == "TOP" and self.db.cooldown and self.db.buffsEnabled then if self.db.buffsCooldownPos == "TOP" and self.db.cooldownYPos == "TOP" and self.db.cooldown and self.db.buffsEnabled then
margin = margin + 1 margin = margin + 1
height = height + (teamSize - 1)
end end
if self.db.buffsCooldownPos == "BOTTOM" and self.db.cooldownYPos == "BOTTOM" and self.db.cooldown and self.db.buffsEnabled then if self.db.buffsCooldownPos == "BOTTOM" and self.db.cooldownYPos == "BOTTOM" and self.db.cooldown and self.db.buffsEnabled then
margin = margin + 1 margin = margin + 1
height = height + (teamSize - 1)
end end
-- Classicon -- GrowDirection
width = width + iconSize if (self.db.growDirection == "LEFT" or self.db.growDirection == "RIGHT") then
extraBarWidth = extraBarWidth + iconSize width = self.db.barWidth * teamSize + (leftSize + rightSize) * teamSize + self.db.bottomMargin * (teamSize - 1)
height = self.db.healthBarHeight + self.db.powerBarHeight + 1
-- Trinket end
width = width + iconSize
self.frame:SetScale(self.db.frameScale) self.frame:SetScale(self.db.frameScale)
self.frame:SetWidth(width) self.frame:SetWidth(width)
@ -161,53 +185,71 @@ function Gladdy:UpdateFrame()
self.frame:SetPoint("CENTER") self.frame:SetPoint("CENTER")
else else
local scale = self.frame:GetEffectiveScale() local scale = self.frame:GetEffectiveScale()
if (self.db.growUp) 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)
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
--Anchor
self.anchor:SetWidth(width) self.anchor:SetWidth(width)
self.anchor:ClearAllPoints() self.anchor:ClearAllPoints()
if (self.db.growUp) then if (self.db.growDirection == "TOP") then
self.anchor:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") self.anchor:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
else elseif self.growDirection == "BOTTOM" or self.growDirection == "RIGHT" then
self.anchor:SetPoint("BOTTOMLEFT", self.frame, "TOPLEFT") self.anchor:SetPoint("BOTTOMLEFT", self.frame, "TOPLEFT")
else
self.anchor:SetPoint("BOTTOMRIGHT", self.frame, "TOPRIGHT")
end end
if (self.db.locked) then if (self.db.locked) then
self.anchor:Hide() self.anchor:Hide()
self.anchor:Hide()
else else
self.anchor:Show() self.anchor:Show()
end end
for i = 1, teamSize do for i = 1, teamSize do
local button = self.buttons["arena" .. i] local button = self.buttons["arena" .. i]
button:SetWidth(self.db.barWidth + extraBarWidth) button:SetWidth(self.db.barWidth)
button:SetHeight(self.db.healthBarHeight) button:SetHeight(self.db.healthBarHeight)
button.secure:SetWidth(self.db.barWidth) button.secure:SetWidth(self.db.barWidth)
button.secure:SetHeight(self.db.healthBarHeight + extraBarHeight) button.secure:SetHeight(self.db.healthBarHeight + self.db.powerBarHeight + 1)
button:ClearAllPoints() button:ClearAllPoints()
button.secure:ClearAllPoints() button.secure:ClearAllPoints()
if (self.db.growUp) then if (self.db.growDirection == "TOP") then
if (i == 1) then if (i == 1) then
button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", self.db.padding + 2, 0) button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, self.db.powerBarHeight + 1)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT")
else else
button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin) button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT")
end end
else elseif (self.db.growDirection == "BOTTOM") then
if (i == 1) then if (i == 1) then
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", self.db.padding + 2, 0) button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
else else
button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "BOTTOMLEFT", 0, -margin - self.db.bottomMargin) button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "BOTTOMLEFT", 0, -margin - self.db.bottomMargin)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT") button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
end end
elseif (self.db.growDirection == "LEFT") then
if (i == 1) then
button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -rightSize, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
else
button:SetPoint("TOPRIGHT", self.buttons["arena" .. (i - 1)], "TOPLEFT", -rightSize - leftSize - self.db.bottomMargin, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
end
elseif (self.db.growDirection == "RIGHT") then
if (i == 1) then
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
else
button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "TOPRIGHT", leftSize + rightSize + self.db.bottomMargin, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
end
end end
@ -258,7 +300,10 @@ function Gladdy:CreateButton(i)
local button = CreateFrame("Frame", "GladdyButtonFrame" .. i, self.frame) local button = CreateFrame("Frame", "GladdyButtonFrame" .. i, self.frame)
button:EnableMouse(false) button:EnableMouse(false)
button:SetAlpha(0) --button:SetAlpha(0)
--button.texture = button:CreateTexture(nil, "OVERLAY")
--button.texture:SetAllPoints(button)
--button.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate") local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate")
secure:RegisterForClicks("AnyUp") secure:RegisterForClicks("AnyUp")

View File

@ -226,15 +226,16 @@ end
--------------------------- ---------------------------
function BuffsDebuffs:CreateFrame(unit) function BuffsDebuffs:CreateFrame(unit)
local verticalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local debuffFrame = CreateFrame("Frame", "GladdyDebuffs" .. unit, Gladdy.buttons[unit]) local debuffFrame = CreateFrame("Frame", "GladdyDebuffs" .. unit, Gladdy.buttons[unit])
debuffFrame:SetHeight(Gladdy.db.buffsIconSize) debuffFrame:SetHeight(Gladdy.db.buffsIconSize)
debuffFrame:SetWidth(1) debuffFrame:SetWidth(1)
debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, Gladdy.db.highlightBorderSize + Gladdy.db.padding) debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, verticalMargin)
debuffFrame.unit = unit debuffFrame.unit = unit
local buffFrame = CreateFrame("Frame", "GladdyBuffs" .. unit, Gladdy.buttons[unit]) local buffFrame = CreateFrame("Frame", "GladdyBuffs" .. unit, Gladdy.buttons[unit])
buffFrame:SetHeight(Gladdy.db.buffsIconSize) buffFrame:SetHeight(Gladdy.db.buffsIconSize)
buffFrame:SetWidth(1) buffFrame:SetWidth(1)
buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, Gladdy.db.highlightBorderSize + Gladdy.db.padding) buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, verticalMargin)
buffFrame.unit = unit buffFrame.unit = unit
self.frames[unit] = {} self.frames[unit] = {}
self.frames[unit].buffFrame = buffFrame self.frames[unit].buffFrame = buffFrame
@ -277,7 +278,9 @@ end
function BuffsDebuffs:UpdateFrame(unit) function BuffsDebuffs:UpdateFrame(unit)
self.frames[unit].debuffFrame:SetHeight(Gladdy.db.buffsIconSize) self.frames[unit].debuffFrame:SetHeight(Gladdy.db.buffsIconSize)
self.frames[unit].debuffFrame:ClearAllPoints() self.frames[unit].debuffFrame:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize
--DEBUFFS
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
local verticalMargin = -(Gladdy.db.powerBarHeight)/2 local verticalMargin = -(Gladdy.db.powerBarHeight)/2
if Gladdy.db.buffsCooldownPos == "TOP" then if Gladdy.db.buffsCooldownPos == "TOP" then
verticalMargin = horizontalMargin + 1 verticalMargin = horizontalMargin + 1
@ -300,7 +303,7 @@ function BuffsDebuffs:UpdateFrame(unit)
self.frames[unit].debuffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].powerBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin) self.frames[unit].debuffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].powerBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin)
end end
elseif Gladdy.db.buffsCooldownPos == "LEFT" then elseif Gladdy.db.buffsCooldownPos == "LEFT" then
horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
local anchor = Gladdy:GetAnchor(unit, "LEFT") local anchor = Gladdy:GetAnchor(unit, "LEFT")
if anchor == Gladdy.buttons[unit].healthBar then if anchor == Gladdy.buttons[unit].healthBar then
self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset) self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
@ -318,9 +321,10 @@ function BuffsDebuffs:UpdateFrame(unit)
end end
end end
--BUFFS
self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize) self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize)
self.frames[unit].buffFrame:ClearAllPoints() self.frames[unit].buffFrame:ClearAllPoints()
horizontalMargin = Gladdy.db.highlightBorderSize horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
verticalMargin = -(Gladdy.db.powerBarHeight)/2 verticalMargin = -(Gladdy.db.powerBarHeight)/2
if Gladdy.db.buffsBuffsCooldownPos == "TOP" then if Gladdy.db.buffsBuffsCooldownPos == "TOP" then
verticalMargin = horizontalMargin + 1 verticalMargin = horizontalMargin + 1
@ -369,7 +373,7 @@ function BuffsDebuffs:UpdateFrame(unit)
--self.frames[unit].buffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) --self.frames[unit].buffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
local anchor = Gladdy:GetAnchor(unit, "LEFT") local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) - 1 + Gladdy.db.padding
if anchor == Gladdy.buttons[unit].healthBar then if anchor == Gladdy.buttons[unit].healthBar then
self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset) self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
else else
@ -403,7 +407,7 @@ function BuffsDebuffs:UpdateFrame(unit)
--self.frames[unit].buffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) --self.frames[unit].buffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
local anchor = Gladdy:GetAnchor(unit, "RIGHT") local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = Gladdy.db.highlightBorderSize - 1 + Gladdy.db.padding horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) - 1 + Gladdy.db.padding
if anchor == Gladdy.buttons[unit].healthBar then if anchor == Gladdy.buttons[unit].healthBar then
self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset) self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
else else

View File

@ -165,7 +165,7 @@ function Castbar:UpdateFrame(unit)
end end
castBar:ClearAllPoints() castBar:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
if (Gladdy.db.castBarPos == "LEFT") then if (Gladdy.db.castBarPos == "LEFT") then
local anchor = Gladdy:GetAnchor(unit, "LEFT") local anchor = Gladdy:GetAnchor(unit, "LEFT")
if anchor == Gladdy.buttons[unit].healthBar then if anchor == Gladdy.buttons[unit].healthBar then

View File

@ -120,7 +120,7 @@ function Classicon:UpdateFrame(unit)
classIcon:SetHeight(Gladdy.db.classIconSize) classIcon:SetHeight(Gladdy.db.classIconSize)
classIcon:ClearAllPoints() classIcon:ClearAllPoints()
local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
if (Gladdy.db.classIconPos == "LEFT") then if (Gladdy.db.classIconPos == "LEFT") then
classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0) classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0)
else else

View File

@ -135,29 +135,30 @@ function Cooldowns:UpdateFrame(unit)
if (Gladdy.db.cooldown) then if (Gladdy.db.cooldown) then
button.spellCooldownFrame:ClearAllPoints() button.spellCooldownFrame:ClearAllPoints()
local verticalMargin = -(Gladdy.db.powerBarHeight)/2 local verticalMargin = -(Gladdy.db.powerBarHeight)/2
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
if Gladdy.db.cooldownYPos == "TOP" then if Gladdy.db.cooldownYPos == "TOP" then
if Gladdy.db.cooldownXPos == "RIGHT" then if Gladdy.db.cooldownXPos == "RIGHT" then
button.spellCooldownFrame:SetPoint("BOTTOMRIGHT", button.healthBar, "TOPRIGHT", Gladdy.db.cooldownXOffset, Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) -- needs to be properly anchored after trinket button.spellCooldownFrame:SetPoint("BOTTOMRIGHT", button.healthBar, "TOPRIGHT", Gladdy.db.cooldownXOffset, horizontalMargin + Gladdy.db.cooldownYOffset)
else else
button.spellCooldownFrame:SetPoint("BOTTOMLEFT", button.healthBar, "TOPLEFT", Gladdy.db.cooldownXOffset, Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("BOTTOMLEFT", button.healthBar, "TOPLEFT", Gladdy.db.cooldownXOffset, horizontalMargin + Gladdy.db.cooldownYOffset)
end end
elseif Gladdy.db.cooldownYPos == "BOTTOM" then elseif Gladdy.db.cooldownYPos == "BOTTOM" then
if Gladdy.db.cooldownXPos == "RIGHT" then if Gladdy.db.cooldownXPos == "RIGHT" then
button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) -- needs to be properly anchored after trinket button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset)
else else
button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset)
end end
elseif Gladdy.db.cooldownYPos == "LEFT" then elseif Gladdy.db.cooldownYPos == "LEFT" then
local anchor = Gladdy:GetAnchor(unit, "LEFT") local anchor = Gladdy:GetAnchor(unit, "LEFT")
if anchor == Gladdy.buttons[unit].healthBar then if anchor == Gladdy.buttons[unit].healthBar then
button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -(Gladdy.db.highlightBorderSize + Gladdy.db.padding) + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -(horizontalMargin + Gladdy.db.padding) + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
else else
button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
end end
elseif Gladdy.db.cooldownYPos == "RIGHT" then elseif Gladdy.db.cooldownYPos == "RIGHT" then
local anchor = Gladdy:GetAnchor(unit, "RIGHT") local anchor = Gladdy:GetAnchor(unit, "RIGHT")
if anchor == Gladdy.buttons[unit].healthBar then if anchor == Gladdy.buttons[unit].healthBar then
button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.highlightBorderSize + Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
else else
button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
end end
@ -601,7 +602,7 @@ function Cooldowns:GetOptions()
desc = L["Size of each cd icon"], desc = L["Size of each cd icon"],
order = 4, order = 4,
min = 5, min = 5,
max = (Gladdy.db.healthBarHeight + Gladdy.db.castBarHeight + Gladdy.db.powerBarHeight + Gladdy.db.bottomMargin) / 2, max = 50,
}), }),
cooldownWidthFactor = Gladdy:option({ cooldownWidthFactor = Gladdy:option({
type = "range", type = "range",

View File

@ -162,7 +162,7 @@ function Diminishings:UpdateFrame(unit)
end end
drFrame:ClearAllPoints() drFrame:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
if (Gladdy.db.drCooldownPos == "LEFT") then if (Gladdy.db.drCooldownPos == "LEFT") then
local anchor = Gladdy:GetAnchor(unit, "LEFT") local anchor = Gladdy:GetAnchor(unit, "LEFT")
if anchor == Gladdy.buttons[unit].healthBar then if anchor == Gladdy.buttons[unit].healthBar then

View File

@ -164,7 +164,7 @@ function Healthbar:UpdateFrame(unit)
edgeSize = Gladdy.db.healthBarBorderSize }) edgeSize = Gladdy.db.healthBarBorderSize })
healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a) healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a)
healthBar:ClearAllPoints() healthBar:ClearAllPoints()
healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", iconSize, 0) healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", 0, 0)
healthBar:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit], "BOTTOMRIGHT") healthBar:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit], "BOTTOMRIGHT")
healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture)) healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture))

View File

@ -3,10 +3,12 @@ local CreateFrame, UnitIsUnit = CreateFrame, UnitIsUnit
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
local Highlight = Gladdy:NewModule("Highlight", nil, { local Highlight = Gladdy:NewModule("Highlight", nil, {
highlightBorderSize = 2, highlightBorderSize = 1,
highlightInset = false,
targetBorderColor = { r = 1, g = 0.8, b = 0, a = 1 }, targetBorderColor = { r = 1, g = 0.8, b = 0, a = 1 },
focusBorderColor = { r = 1, g = 0, b = 0, a = 1 }, focusBorderColor = { r = 1, g = 0, b = 0, a = 1 },
leaderBorderColor = { r = 0, g = 1, b = 0, a = 1 }, leaderBorderColor = { r = 0, g = 1, b = 0, a = 1 },
highlightBorderStyle = "Square Full White",
highlight = true, highlight = true,
targetBorder = true, targetBorder = true,
focusBorder = true, focusBorder = true,
@ -53,17 +55,17 @@ function Highlight:CreateFrame(unit)
local healthBar = Gladdy.modules.Healthbar.frames[unit] local healthBar = Gladdy.modules.Healthbar.frames[unit]
local targetBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") local targetBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
targetBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
--targetBorder:SetFrameStrata("MEDIUM") --targetBorder:SetFrameStrata("MEDIUM")
targetBorder:Hide() targetBorder:Hide()
local focusBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") local focusBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
focusBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
--focusBorder:SetFrameStrata("MEDIUM") --focusBorder:SetFrameStrata("MEDIUM")
focusBorder:Hide() focusBorder:Hide()
local leaderBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") local leaderBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
leaderBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
--leaderBorder:SetFrameStrata("MEDIUM") --leaderBorder:SetFrameStrata("MEDIUM")
leaderBorder:Hide() leaderBorder:Hide()
@ -88,29 +90,48 @@ function Highlight:UpdateFrame(unit)
end end
local borderSize = Gladdy.db.highlightBorderSize local borderSize = Gladdy.db.highlightBorderSize
local borderOffset = borderSize
local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight + 1 local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight + 1
local width = Gladdy.db.barWidth + borderSize * 2 local width = Gladdy.db.barWidth + (Gladdy.db.highlightInset and 0 or borderSize * 2)
local height = iconSize + borderSize * 2 local height = iconSize + (Gladdy.db.highlightInset and 0 or borderSize * 2)
button.targetBorder:SetWidth(width) button.targetBorder:SetWidth(width)
button.targetBorder:SetHeight(height) button.targetBorder:SetHeight(height)
button.targetBorder:ClearAllPoints() button.targetBorder:ClearAllPoints()
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) if Gladdy.db.highlightInset then
button.targetBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) button.targetBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.targetBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.targetBorder:SetBackdropBorderColor(Gladdy.db.targetBorderColor.r, Gladdy.db.targetBorderColor.g, Gladdy.db.targetBorderColor.b, Gladdy.db.targetBorderColor.a) button.targetBorder:SetBackdropBorderColor(Gladdy.db.targetBorderColor.r, Gladdy.db.targetBorderColor.g, Gladdy.db.targetBorderColor.b, Gladdy.db.targetBorderColor.a)
button.focusBorder:SetWidth(width) button.focusBorder:SetWidth(width)
button.focusBorder:SetHeight(height) button.focusBorder:SetHeight(height)
button.focusBorder:ClearAllPoints() button.focusBorder:ClearAllPoints()
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) if Gladdy.db.highlightInset then
button.focusBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) button.focusBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.focusBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.focusBorder:SetBackdropBorderColor(Gladdy.db.focusBorderColor.r, Gladdy.db.focusBorderColor.g, Gladdy.db.focusBorderColor.b, Gladdy.db.focusBorderColor.a) button.focusBorder:SetBackdropBorderColor(Gladdy.db.focusBorderColor.r, Gladdy.db.focusBorderColor.g, Gladdy.db.focusBorderColor.b, Gladdy.db.focusBorderColor.a)
button.leaderBorder:SetWidth(width) button.leaderBorder:SetWidth(width)
button.leaderBorder:SetHeight(height) button.leaderBorder:SetHeight(height)
button.leaderBorder:ClearAllPoints() button.leaderBorder:ClearAllPoints()
button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) if Gladdy.db.highlightInset then
button.leaderBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) button.leaderBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.leaderBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.leaderBorder:SetBackdropBorderColor(Gladdy.db.leaderBorderColor.r, Gladdy.db.leaderBorderColor.g, Gladdy.db.leaderBorderColor.b, Gladdy.db.leaderBorderColor.a) button.leaderBorder:SetBackdropBorderColor(Gladdy.db.leaderBorderColor.r, Gladdy.db.leaderBorderColor.g, Gladdy.db.leaderBorderColor.b, Gladdy.db.leaderBorderColor.a)
if Gladdy.frame.testing then if Gladdy.frame.testing then
Highlight:Test(unit) Highlight:Test(unit)
@ -179,34 +200,52 @@ function Highlight:GetOptions()
name = L["Highlight"], name = L["Highlight"],
order = 2, order = 2,
}, },
highlightBorderSize = { highlightInset = Gladdy:option({
type = "toggle",
name = L["Show Inside"],
desc = L["Show Highlight border inside of frame"],
order = 3,
}),
highlightBorderSize = Gladdy:option({
type = "range", type = "range",
name = L["Border size"], name = L["Border size"],
desc = L["Border size"], desc = L["Border size"],
order = 3, order = 4,
min = 1, min = 1,
max = 10, max = 20,
step = 1, step = 1,
}),
highlightBorderStyle = Gladdy:option({
type = "select",
name = L["Border style"],
order = 5,
dialogControl = "LSM30_Border",
values = AceGUIWidgetLSMlists.border,
}),
headerColor = {
type = "header",
name = L["Colors"],
order = 6,
}, },
targetBorderColor = Gladdy:colorOption({ targetBorderColor = Gladdy:colorOption({
type = "color", type = "color",
name = L["Target border color"], name = L["Target border color"],
desc = L["Color of the selected targets border"], desc = L["Color of the selected targets border"],
order = 4, order = 7,
hasAlpha = true, hasAlpha = true,
}), }),
focusBorderColor = Gladdy:colorOption({ focusBorderColor = Gladdy:colorOption({
type = "color", type = "color",
name = L["Focus border color"], name = L["Focus border color"],
desc = L["Color of the focus border"], desc = L["Color of the focus border"],
order = 5, order = 8,
hasAlpha = true, hasAlpha = true,
}), }),
leaderBorderColor = Gladdy:colorOption({ leaderBorderColor = Gladdy:colorOption({
type = "color", type = "color",
name = L["Raid leader border color"], name = L["Raid leader border color"],
desc = L["Color of the raid leader border"], desc = L["Color of the raid leader border"],
order = 6, order = 9,
hasAlpha = true, hasAlpha = true,
}), }),
headerEnable = { headerEnable = {

View File

@ -134,7 +134,7 @@ function Racial:UpdateFrame(unit)
racial.texture.overlay:SetVertexColor(Gladdy.db.racialBorderColor.r, Gladdy.db.racialBorderColor.g, Gladdy.db.racialBorderColor.b, Gladdy.db.racialBorderColor.a) racial.texture.overlay:SetVertexColor(Gladdy.db.racialBorderColor.r, Gladdy.db.racialBorderColor.g, Gladdy.db.racialBorderColor.b, Gladdy.db.racialBorderColor.a)
racial:ClearAllPoints() racial:ClearAllPoints()
local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local parent = Gladdy.buttons[unit][Gladdy.db.racialAnchor] local parent = Gladdy.buttons[unit][Gladdy.db.racialAnchor]
if (Gladdy.db.racialPos == "RIGHT") then if (Gladdy.db.racialPos == "RIGHT") then
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset) racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset)
@ -237,7 +237,7 @@ function Racial:GetOptions()
header = { header = {
type = "header", type = "header",
name = L["Size"], name = L["Size"],
order = 4, order = 1,
}, },
racialSize = Gladdy:option({ racialSize = Gladdy:option({
type = "range", type = "range",
@ -245,7 +245,7 @@ function Racial:GetOptions()
min = 5, min = 5,
max = 100, max = 100,
step = 1, step = 1,
order = 4, order = 2,
}), }),
racialWidthFactor = Gladdy:option({ racialWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -253,7 +253,7 @@ function Racial:GetOptions()
min = 0.5, min = 0.5,
max = 2, max = 2,
step = 0.05, step = 0.05,
order = 6, order = 3,
}), }),
}, },
}, },

View File

@ -130,7 +130,7 @@ function Trinket:UpdateFrame(unit)
trinket.texture.overlay:SetVertexColor(Gladdy.db.trinketBorderColor.r, Gladdy.db.trinketBorderColor.g, Gladdy.db.trinketBorderColor.b, Gladdy.db.trinketBorderColor.a) trinket.texture.overlay:SetVertexColor(Gladdy.db.trinketBorderColor.r, Gladdy.db.trinketBorderColor.g, Gladdy.db.trinketBorderColor.b, Gladdy.db.trinketBorderColor.a)
trinket:ClearAllPoints() trinket:ClearAllPoints()
local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
if (Gladdy.db.classIconPos == "LEFT") then if (Gladdy.db.classIconPos == "LEFT") then
if (Gladdy.db.trinketPos == "RIGHT") then if (Gladdy.db.trinketPos == "RIGHT") then
trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", margin, 0) trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", margin, 0)