do calculation inline

This commit is contained in:
Will McGugan
2022-09-07 11:27:04 +01:00
parent fecb9a81cb
commit ab3085a59a

View File

@@ -30,11 +30,6 @@ class WidgetPlacement(NamedTuple):
order: int = 0
fixed: bool = False
@property
def margin_region(self) -> Region:
"""Get region with margin applied."""
return self.region.grow(self.margin)
class Layout(ABC):
"""Responsible for arranging Widgets in a view and rendering them."""
@@ -96,5 +91,8 @@ class Layout(ABC):
height = container.height
else:
placements, *_ = widget._arrange(Size(width, container.height))
height = max(placement.margin_region.bottom for placement in placements)
height = max(
placement.region.bottom + placement.margin.bottom
for placement in placements
)
return height