Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Oct 14, 2024
1 parent f6f695f commit 41441df
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/textual/_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,10 @@ def resolve_box_models(
List of resolved box models.
"""

margins = [widget.styles.margin for widget in widgets]

margin_width, margin_height = margin

fraction_width = Fraction(size.width)
fraction_height = Fraction(size.height)
fraction_zero = Fraction(0)

margin_size = size - margin

# Fixed box models
Expand All @@ -215,11 +211,11 @@ def resolve_box_models(
else widget._get_box_model(
size,
viewport_size,
max(fraction_zero, fraction_width - margin.width),
max(fraction_zero, fraction_height - margin.height),
max(fraction_zero, fraction_width - widget.styles.margin.width),
max(fraction_zero, fraction_height - widget.styles.margin.height),
)
)
for (_dimension, widget, margin) in zip(dimensions, widgets, margins)
for (_dimension, widget) in zip(dimensions, widgets)
]

if None not in box_models:
Expand Down

0 comments on commit 41441df

Please sign in to comment.