This commit is contained in:
firestarsdog
2026-08-22 04:51:33 -04:00
parent 4b3372d006
commit 7c6741a93e
3 changed files with 186 additions and 10 deletions
@@ -54,6 +54,7 @@ class FavoriteRadialMenu:
CORNER_HINT_OUTER_RADIUS = 62.0
CORNER_HINT_RING_RADIUS = 42.0
CORNER_HINT_EDGE_MARGIN = 6.0
_ELLIPSIS = "..."
_PURPLE = (161, 112, 255)
_PANEL = rl.Color(13, 11, 23, 236)
@@ -1083,7 +1084,7 @@ class FavoriteRadialMenu:
return ""
if FavoriteRadialMenu._measure_text(font, text, font_size).x <= max_width:
return text
ellipsis = "..."
ellipsis = FavoriteRadialMenu._ELLIPSIS
if FavoriteRadialMenu._measure_text(font, ellipsis, font_size).x > max_width:
return ""
shortened = text
@@ -1101,7 +1102,7 @@ class FavoriteRadialMenu:
@staticmethod
def _append_ellipsis(font: Any, text: str, font_size: int, max_width: float) -> str:
ellipsis = ""
ellipsis = FavoriteRadialMenu._ELLIPSIS
if max_width <= 0 or FavoriteRadialMenu._measure_text(font, ellipsis, font_size).x > max_width:
return ""
@@ -325,7 +325,7 @@ def test_picker_description_uses_measured_wrap_and_truncates_to_two_lines(monkey
assert wrap_calls[0][0] == long_description
assert wrap_calls[0][1] >= 24
assert wrap_calls[0][2] > 0
assert drawn_texts[-2:] == ["Measured first line", "Measured second line"]
assert drawn_texts[-2:] == ["Measured first line", "Measured second line..."]
def test_picker_uses_compact_section_labels_without_mutating_catalog_copy():
@@ -342,9 +342,9 @@ def test_picker_fit_text_truncates_at_word_boundary(monkeypatch):
monkeypatch.setattr(FavoriteRadialMenu, "_measure_text",
staticmethod(lambda _font, text, _font_size: rl.Vector2(len(text) * 10, 20)))
fitted = FavoriteRadialMenu._fit_picker_text(object(), "Longitudinal Speed Following", 24, 140)
fitted = FavoriteRadialMenu._fit_picker_text(object(), "Longitudinal Speed Following", 24, 160)
assert fitted == "Longitudinal…"
assert fitted == "Longitudinal..."
def test_picker_wraps_long_titles_by_measured_words(monkeypatch):
File diff suppressed because it is too large Load Diff