maze: refactor move_to_center

This commit is contained in:
Dmitry Belyaev 2024-03-28 14:38:57 +03:00
parent f0d2949ce5
commit 0bc9777bfb

View File

@ -197,10 +197,9 @@ def choose_plural(amount, declensions):
def move_to_center(obj, scene_sz):
"""Перемещает объект к центру"""
bounds = bbox(obj)
width = bounds[2] - bounds[0]
height = bounds[3] - bounds[1]
p = scene_sz // 2 - Coords(width, height) // 2
x1, y1, x2, y2 = bbox(obj)
obj_sz = Coords(x2, y2) - Coords(x1, y1)
p = scene_sz // 2 - obj_sz // 2
moveObjectTo(obj, *p)