From 75bf0b9c9adaf65f8bcd3474e8ccd4292d327327 Mon Sep 17 00:00:00 2001 From: salt-die Date: Sun, 24 Nov 2024 01:04:23 -0600 Subject: [PATCH] Fix `to_local` for root gadget. --- src/batgrl/gadgets/gadget.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/batgrl/gadgets/gadget.py b/src/batgrl/gadgets/gadget.py index a9d0e43d..88cd102b 100644 --- a/src/batgrl/gadgets/gadget.py +++ b/src/batgrl/gadgets/gadget.py @@ -817,10 +817,8 @@ def to_local(self, point: Point) -> Point: The point in local coordinates. """ if self.parent is None: - return point - - y, x = self.parent.to_local(point) - return Point(y - self.top, x - self.left) + return point - self.pos + return self.parent.to_local(point) - self.pos def collides_point(self, point: Point) -> bool: """