Skip to content

Commit

Permalink
restore widget region
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Nov 18, 2024
1 parent 9d8a358 commit 073eb0e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/textual/_compositor.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,27 +716,23 @@ def add_widget(
elif visible:
# Add the widget to the map

widget_region = region

if widget.absolute_offset is not None:
margin = styles.margin
widget_region = widget_region.at_offset(
widget.absolute_offset + margin.top_left
)
widget_region = widget_region.translate(
styles.offset.resolve(widget_region.grow(margin).size, size)
region = region.at_offset(widget.absolute_offset + margin.top_left)
region = region.translate(
styles.offset.resolve(region.grow(margin).size, size)
)
has_rule = styles.has_rule
if has_rule("constrain_x") or has_rule("constrain_y"):
widget_region = widget_region.constrain(
region = region.constrain(
styles.constrain_x,
styles.constrain_y,
styles.margin,
size.region,
)

map[widget._render_widget] = _MapGeometry(
widget_region,
region,
order,
clip,
region.size,
Expand Down

0 comments on commit 073eb0e

Please sign in to comment.