From 349f414dacbb370a2788f89ed1dc22f083886fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Tue, 11 Apr 2023 14:51:59 +0100 Subject: [PATCH] Use Offset operators. --- src/textual/widget.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/textual/widget.py b/src/textual/widget.py index a628bf94b3..a5a422cb1a 100644 --- a/src/textual/widget.py +++ b/src/textual/widget.py @@ -2464,15 +2464,11 @@ async def _scroll_to_center_of( # We add that to `container_virtual_region.y` to find the total vertical # offset of the central point with respect to the container of `container`. # A similar calculation is made for the horizontal update. - central_point = Offset( - container_virtual_region.x - + central_point.x - - container.scroll_offset.x - - scroll.x, - container_virtual_region.y - + central_point.y - - container.scroll_offset.y - - scroll.y, + central_point = ( + container_virtual_region.offset + + central_point + - container.scroll_offset + - scroll ) widget = container container = widget.parent