Skip to content

Commit

Permalink
add .Width and .Height scale funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Krealle committed Nov 5, 2024
1 parent a2491c1 commit 2dbb96f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
31 changes: 30 additions & 1 deletion Util/PixelPerfect.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function PixelPerfect.GetPositionRelativeToScreenCenter(frame)
end

---@param num number
---@return number
function PixelPerfect.Scale(num)
if CUF.vars.useScaling then
return CellP:Scale(num)
Expand All @@ -104,17 +105,45 @@ function PixelPerfect.Scale(num)
return num
end

---@param frame Frame
---@param frame Frame|Texture
---@param width number
---@param height number
---@overload fun(frame: Frame|Texture, size: number)
function PixelPerfect.Size(frame, width, height)
if not width then return end
height = height or width

if CUF.vars.useScaling then
CellP:Size(frame, width, height)
else
frame:SetSize(width, height)
end
end

---@param frame Frame|Texture
---@param size number
function PixelPerfect.Width(frame, size)
if not size then return end

if CUF.vars.useScaling then
CellP:Width(frame, size)
else
frame:SetWidth(size)
end
end

---@param frame Frame|Texture
---@param size number
function PixelPerfect.Height(frame, size)
if not size then return end

if CUF.vars.useScaling then
CellP:Height(frame, size)
else
frame:SetHeight(size)
end
end

---@param frame Frame|Texture
function PixelPerfect.Point(frame, ...)
if CUF.vars.useScaling then
Expand Down
8 changes: 4 additions & 4 deletions Widgets/Bars/ShieldBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ local function Repoint(bar, anchorPoint)
P.Point(bar.overShieldGlow, "TOPRIGHT", bar.parentHealthBar)
P.Point(bar.overShieldGlow, "BOTTOMRIGHT", bar.parentHealthBar)
F:RotateTexture(bar.overShieldGlow, 0)
bar.overShieldGlow:SetWidth(4)
P.Width(bar.overShieldGlow, 4)

P.Point(bar.overShieldGlowReverse, "TOP", bar.shieldReverse, "TOPLEFT")
P.Point(bar.overShieldGlowReverse, "BOTTOM", bar.shieldReverse, "BOTTOMLEFT")
F:RotateTexture(bar.overShieldGlowReverse, 0)
bar.overShieldGlowReverse:SetWidth(4)
P.Width(bar.overShieldGlowReverse, 4)
else
bar.SetValue = ShieldBar_SetValue_Vertical

Expand All @@ -286,12 +286,12 @@ local function Repoint(bar, anchorPoint)
P.Point(bar.overShieldGlow, "TOPLEFT", bar.parentHealthBar)
P.Point(bar.overShieldGlow, "TOPRIGHT", bar.parentHealthBar)
F:RotateTexture(bar.overShieldGlow, 90)
bar.overShieldGlow:SetHeight(4)
P.Height(bar.overShieldGlow, 4)

P.Point(bar.overShieldGlowReverse, "LEFT", bar.shieldReverse, "BOTTOMLEFT")
P.Point(bar.overShieldGlowReverse, "RIGHT", bar.shieldReverse, "BOTTOMRIGHT")
F:RotateTexture(bar.overShieldGlowReverse, 90)
bar.overShieldGlowReverse:SetHeight(4)
P.Height(bar.overShieldGlowReverse, 4)
end
end

Expand Down

0 comments on commit 2dbb96f

Please sign in to comment.