From 073eb0e0ee8d29eb220fc967d3d55c80cf83e71a Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Mon, 18 Nov 2024 15:07:04 +0000 Subject: [PATCH] restore widget region --- src/textual/_compositor.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/textual/_compositor.py b/src/textual/_compositor.py index e59db3af29..e2fe68bc8d 100644 --- a/src/textual/_compositor.py +++ b/src/textual/_compositor.py @@ -716,19 +716,15 @@ 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, @@ -736,7 +732,7 @@ def add_widget( ) map[widget._render_widget] = _MapGeometry( - widget_region, + region, order, clip, region.size,