mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Fixe Player Name Size Limit
This commit is contained in:
@@ -40,15 +40,17 @@ function drawing.limit_text_size(text, size_limit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local limited_text = text;
|
local limited_text = text;
|
||||||
while true do
|
while limited_text ~= "..." do
|
||||||
local text_width, text_height = drawing.font:measure(limited_text);
|
local text_width, text_height = drawing.font:measure(limited_text);
|
||||||
|
|
||||||
if text_width < size_limit then
|
if text_width < size_limit then
|
||||||
return limited_text;
|
break;
|
||||||
else
|
else
|
||||||
limited_text = unicode_helpers.sub(limited_text, 1, -5) .. "...";
|
limited_text = unicode_helpers.sub(limited_text, 1, -5) .. "...";
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return limited_text;
|
||||||
end
|
end
|
||||||
|
|
||||||
function drawing.scale_color_opacity(color, scale)
|
function drawing.scale_color_opacity(color, scale)
|
||||||
|
|||||||
Reference in New Issue
Block a user