declare default for lsp

This commit is contained in:
Michael Freno
2025-10-09 22:23:18 -04:00
parent 9ad3f058a7
commit 67e32af78d

View File

@@ -8,10 +8,10 @@ local Color = {}
Color.__index = Color
--- Create a new color instance
---@param r number?
---@param g number?
---@param b number?
---@param a number? -- default 1
---@param r number? -- Default: 0
---@param g number? -- Default: 0
---@param b number? -- Default: 0
---@param a number? -- Default: 1
---@return Color
function Color.new(r, g, b, a)
local self = setmetatable({}, Color)
@@ -729,7 +729,7 @@ function Element.new(props)
-- Calculate what percentage of viewport height this represents
local vhValue = (props.textSize / viewportHeight) * 100
self.units.textSize = { value = vhValue, unit = "vh" }
self.textSize = props.textSize -- Initial size is the specified pixel value
self.textSize = props.textSize -- Initial size is the specified pixel value
else
-- Apply base scaling to pixel text sizes (no auto-scaling)
self.textSize = Gui.baseScale and (props.textSize * scaleY) or props.textSize
@@ -762,7 +762,7 @@ function Element.new(props)
-- Protect against too-small text sizes (minimum 1px)
if self.textSize < 1 then
self.textSize = 1 -- Minimum 1px
self.textSize = 1 -- Minimum 1px
end
-- Store original spacing values for proper resize handling
@@ -1710,7 +1710,7 @@ function Element:recalculateUnits(newViewportWidth, newViewportHeight)
-- Protect against too-small text sizes (minimum 1px)
if self.textSize < 1 then
self.textSize = 1 -- Minimum 1px
self.textSize = 1 -- Minimum 1px
end
elseif self.units.textSize.unit == "px" and self.units.textSize.value and Gui.baseScale then
-- Reapply base scaling to pixel text sizes
@@ -1718,13 +1718,13 @@ function Element:recalculateUnits(newViewportWidth, newViewportHeight)
-- Protect against too-small text sizes (minimum 1px)
if self.textSize < 1 then
self.textSize = 1 -- Minimum 1px
self.textSize = 1 -- Minimum 1px
end
end
-- Final protection: ensure textSize is always at least 1px (catches all edge cases)
if self.text and self.textSize and self.textSize < 1 then
self.textSize = 1 -- Minimum 1px
self.textSize = 1 -- Minimum 1px
end
-- Recalculate gap if using viewport or percentage units