[TIZI/TICI] ui: override set_parent_rect to dynamically update item height (#1689)

[TIZI/TICI] ui: override `set_parent_rect` method to update item height dynamically
This commit is contained in:
Jason Wen
2026-02-12 22:07:05 -05:00
committed by GitHub
parent 86d52ab969
commit dae95af1df

View File

@@ -212,6 +212,12 @@ class ListItemSP(ListItem):
content_width = int(self._rect.width - style.ITEM_PADDING * 2)
self._rect.height = self.get_item_height(self._font, content_width)
def set_parent_rect(self, parent_rect: rl.Rectangle) -> None:
super().set_parent_rect(parent_rect)
if self.description_visible:
content_width = int(self._rect.width - style.ITEM_PADDING * 2)
self._rect.height = self.get_item_height(self._font, content_width)
def get_item_height(self, font: rl.Font, max_width: int) -> float:
height = super().get_item_height(font, max_width)