projects
/
erdslangetjie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f9257ac
)
Avoid a infinite loop when scrolling is involved
author
Neil
<neil@dip.sun.ac.za>
Sat, 20 Apr 2013 10:22:14 +0000
(12:22 +0200)
committer
Neil
<neil@dip.sun.ac.za>
Sat, 20 Apr 2013 10:22:14 +0000
(12:22 +0200)
erdslangetjie/__main__.py
patch
|
blob
|
history
diff --git
a/erdslangetjie/__main__.py
b/erdslangetjie/__main__.py
index 8071d303de802105fa12e429579315a02ff163bc..e408ac8204851dcb0ee40209e4a7c5adea5ab8be 100644
(file)
--- 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)
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)
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)
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)
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:
def included(self, point, margin):
if point[0] < margin: