Skip to content

Commit 5386cc7

Browse files
committed
Fix multi-column item tooltip overflow
If tooltips with more than 1 column overflow the viewport they are now moved to the left, as much as needed and the viewport allows
1 parent f52d3cd commit 5386cc7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Classes/Tooltip.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,15 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
367367
ttY = m_max(viewPort.y, y + h - ttH)
368368
end
369369
end
370-
370+
-- Initial column calculation
371371
local columns, maxColumnHeight, drawStack = self:CalculateColumns(ttY, ttX, ttH, ttW, viewPort)
372372

373+
-- If extra columns don't fit, shift to left and recalculate drawStack
374+
if columns > 1 and ttW * columns + ttX >= viewPort.x + viewPort.width then
375+
ttX = m_max(viewPort.x, viewPort.x + viewPort.width - ttW * columns)
376+
columns, maxColumnHeight, drawStack = self:CalculateColumns(ttY, ttX, ttH, ttW, viewPort)
377+
end
378+
373379
-- background shading currently must be drawn before text lines. API change will allow something like the commented lines below
374380
SetDrawColor(0, 0, 0, .85)
375381
--SetDrawLayer(nil, GetDrawLayer() - 5)

0 commit comments

Comments
 (0)