From 0080c0de7839cbd036f9c2eefcbe4e6c10169fba Mon Sep 17 00:00:00 2001 From: Rene Horn Date: Sat, 8 Dec 2012 11:04:33 -0600 Subject: [PATCH 1/2] Added a check for horizontal scrolling for sxd for if we are actually scrolling horizontally. --- kivy/uix/scrollview.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kivy/uix/scrollview.py b/kivy/uix/scrollview.py index 3eeb44c84..4adb74873 100644 --- a/kivy/uix/scrollview.py +++ b/kivy/uix/scrollview.py @@ -368,11 +368,12 @@ class ScrollView(StencilView): sxd = self._scroll_x_mouse - d elif touch.button == 'scrollleft': sxd = self._scroll_x_mouse + d - self._scroll_x_mouse = scroll_x = min(max(sxd, 0), 1) - Animation.stop_all(self, 'scroll_x') - Animation(scroll_x=scroll_x, d=.3, t='out_quart').start(self) - Clock.unschedule(self._update_animation) - return True + if sxd is not None: + self._scroll_x_mouse = scroll_x = min(max(sxd, 0), 1) + Animation.stop_all(self, 'scroll_x') + Animation(scroll_x=scroll_x, d=.3, t='out_quart').start(self) + Clock.unschedule(self._update_animation) + return True self._touch = touch uid = self._get_uid() From 49fdf1012035900bddcfce213e8d4923992f51d4 Mon Sep 17 00:00:00 2001 From: Rene Horn Date: Sat, 8 Dec 2012 11:19:51 -0600 Subject: [PATCH 2/2] Woops, forgot to actually define sxd to None. --- kivy/uix/scrollview.py | 1 + 1 file changed, 1 insertion(+) diff --git a/kivy/uix/scrollview.py b/kivy/uix/scrollview.py index 4adb74873..4ba26a38a 100644 --- a/kivy/uix/scrollview.py +++ b/kivy/uix/scrollview.py @@ -362,6 +362,7 @@ class ScrollView(StencilView): if vp.width > self.width: # let's say we want to move over 40 pixels each scroll d = (vp.width - self.width) + sxd = None if d != 0: d = self.scroll_distance / float(d) if touch.button == 'scrollright':