Skip to content

Commit b26c2ac

Browse files
authored
Add black background to detail text in character dropdown (#8487)
* FIX: add black background to detail text in character dropdown Character names are currently drawn over the top of the details on the right of the dropdown. If a name happens to be very long (often happens when using tofu for utf-8) the details stop being legible. This adds a black background behind the detail text to make it more readable. * FIX: fix import dropdown detail visibility when no explicit color code is used
1 parent d90c681 commit b26c2ac

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

src/Classes/DropDownControl.lua

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,19 @@ function DropDownClass:Draw(viewPort, noTooltip)
319319
DrawString(0, 0, "LEFT", lineHeight, "VAR", selLabel or "")
320320
if selDetail ~= nil then
321321
local dx = DrawStringWidth(lineHeight, "VAR", selDetail)
322+
if not enabled or self.dropped then
323+
SetDrawColor(0, 0, 0)
324+
elseif mOver then
325+
SetDrawColor(0.33, 0.33, 0.33)
326+
else
327+
SetDrawColor(0, 0, 0)
328+
end
329+
DrawImage(nil, width - dx - 4 - 22, 0, width - 4, lineHeight)
330+
if enabled then
331+
SetDrawColor(1, 1, 1)
332+
else
333+
SetDrawColor(0.66, 0.66, 0.66)
334+
end
322335
DrawString(width - dx - 22, 0, "LEFT", lineHeight, "VAR", selDetail)
323336
end
324337
SetViewport()
@@ -378,7 +391,19 @@ function DropDownClass:Draw(viewPort, noTooltip)
378391
DrawString(0, y, "LEFT", lineHeight, "VAR", label)
379392
if detail ~= nil then
380393
local detail = listVal.detail
381-
dx = DrawStringWidth(lineHeight, "VAR", detail)
394+
local dx = DrawStringWidth(lineHeight, "VAR", detail)
395+
if index == self.hoverSel then
396+
SetDrawColor(0.33, 0.33, 0.33)
397+
else
398+
SetDrawColor(0, 0, 0)
399+
end
400+
DrawImage(nil, width - dx - 8 - 22, y, width - 4, lineHeight)
401+
-- highlight font color if hovered or selected
402+
if index == self.hoverSel or index == self.selIndex then
403+
SetDrawColor(1, 1, 1)
404+
else
405+
SetDrawColor(0.66, 0.66, 0.66)
406+
end
382407
DrawString(width - dx - 4 - 22, y, "LEFT", lineHeight, "VAR", detail)
383408
end
384409
self:DrawSearchHighlights(label, searchInfo, 0, y, width - 4, lineHeight)

0 commit comments

Comments
 (0)