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