From 0bc9777bfba3d945174437a1e4a80094bddd3f12 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 28 Mar 2024 14:38:57 +0300 Subject: [PATCH] maze: refactor move_to_center --- mod_graph/maze.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mod_graph/maze.py b/mod_graph/maze.py index a775f55..75eb57d 100644 --- a/mod_graph/maze.py +++ b/mod_graph/maze.py @@ -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)