From f05ea56092899055d0c96e8f3a2eb7a1c74b5c84 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 20 Apr 2013 12:22:14 +0200 Subject: [PATCH] Avoid a infinite loop when scrolling is involved --- erdslangetjie/__main__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/erdslangetjie/__main__.py b/erdslangetjie/__main__.py index 8071d30..e408ac8 100644 --- a/erdslangetjie/__main__.py +++ b/erdslangetjie/__main__.py @@ -126,15 +126,28 @@ class GameWindow(RelativeLayout): if true_point[0] >= self.view.size[0]: self.view.scroll_x += self.x_scroll_margin true_point = self.to_parent(*check_point) + # Avoid an infinite loop that can happen we + # changing screens + if self.view.scroll_x > 0.99: + return elif true_point[0] < 0: self.view.scroll_x -= self.x_scroll_margin true_point = self.to_parent(*check_point) + # See above + if self.view.scroll_x < 0.01: + return elif true_point[1] >= self.view.size[1]: self.view.scroll_y += self.y_scroll_margin true_point = self.to_parent(*check_point) + # See above + if self.view.scroll_y > 0.99: + return elif true_point[1] < 0: self.view.scroll_y -= self.y_scroll_margin true_point = self.to_parent(*check_point) + # See above + if self.view.scroll_y < 0.01: + return def included(self, point, margin): if point[0] < margin: -- 2.34.1