Skip to content

Commit

Permalink
Use Offset operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigogiraoserrao committed Apr 11, 2023
1 parent 8fe9e97 commit 349f414
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/textual/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 349f414

Please sign in to comment.