From e9b82dca8b76e447575afe5048c7a4ea945d3768 Mon Sep 17 00:00:00 2001 From: Matthew Einhorn Date: Mon, 2 Oct 2017 13:15:52 -0400 Subject: [PATCH] Don't pass touch to children when outside the sv. --- kivy/uix/scrollview.py | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/kivy/uix/scrollview.py b/kivy/uix/scrollview.py index f1bdc15be..704f09a7c 100644 --- a/kivy/uix/scrollview.py +++ b/kivy/uix/scrollview.py @@ -722,17 +722,22 @@ class ScrollView(StencilView): def on_touch_move(self, touch): if self._touch is not touch: - # touch is in parent - touch.push() - touch.apply_transform_2d(self.to_local) - super(ScrollView, self).on_touch_move(touch) - touch.pop() + # don't pass on touch to children if outside the sv + if self.collide_point(*touch.pos): + # touch is in parent + touch.push() + touch.apply_transform_2d(self.to_local) + super(ScrollView, self).on_touch_move(touch) + touch.pop() return self._get_uid() in touch.ud if touch.grab_current is not self: return True if touch.ud.get(self._get_uid()) is None: - return super(ScrollView, self).on_touch_move(touch) + # don't pass on touch to children if outside the sv + if self.collide_point(*touch.pos): + return super(ScrollView, self).on_touch_move(touch) + return False touch.ud['sv.handled'] = {'x': False, 'y': False} if self.dispatch('on_scroll_move', touch): @@ -818,13 +823,15 @@ class ScrollView(StencilView): def on_touch_up(self, touch): uid = self._get_uid('svavoid') if self._touch is not touch and uid not in touch.ud: - # touch is in parents - touch.push() - touch.apply_transform_2d(self.to_local) - if super(ScrollView, self).on_touch_up(touch): + # don't pass on touch to children if outside the sv + if self.collide_point(*touch.pos): + # touch is in parents + touch.push() + touch.apply_transform_2d(self.to_local) + if super(ScrollView, self).on_touch_up(touch): + touch.pop() + return True touch.pop() - return True - touch.pop() return False if self.dispatch('on_scroll_stop', touch):