Skip to content

Commit

Permalink
Fix fun edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
boatbomber committed Dec 28, 2024
1 parent 03d167a commit 5150967
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/src/App/Components/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local TooltipContext = Roact.createContext({})

local function Popup(props)
return Theme.with(function(theme)
local textXSpace = math.min(props.parentSize.X, 250)
local textXSpace = math.min(props.parentSize.X, 250) - TEXT_PADDING.X
local textBounds = getTextBoundsAsync(props.Text, theme.Font.Main, theme.TextSize.Medium, textXSpace)
local contentSize = textBounds + TEXT_PADDING + (Vector2.one * 2)

Expand All @@ -36,7 +36,7 @@ local function Popup(props)
-- If there's not enough space below, and there's more space above, then show the tooltip above the trigger
local displayAbove = spaceBelow < contentSize.Y and spaceAbove > spaceBelow

local X = math.clamp(props.Position.X - X_OFFSET, 0, props.parentSize.X - contentSize.X)
local X = math.clamp(props.Position.X - X_OFFSET, 0, math.max(props.parentSize.X - contentSize.X, 1))
local Y = 0

if displayAbove then
Expand Down

0 comments on commit 5150967

Please sign in to comment.