mirror of https://github.com/kivy/kivy.git
scrollview: avoid all the touch outside the view. Because the drawing is outside the view is removed, it make no sense to dispatch touch. We was actually having an issue cause of that with the filebrowser: touching outside the view on a possible element was catched and used by the filebrowser.
This commit is contained in:
parent
ed4218047c
commit
435443c61d
|
@ -198,8 +198,8 @@ class ScrollView(StencilView):
|
|||
if widget is self._viewport:
|
||||
self._viewport = None
|
||||
|
||||
def _get_uid(self):
|
||||
return 'sv.%d' % id(self)
|
||||
def _get_uid(self, prefix='sv'):
|
||||
return '{0}.{1}'.format(prefix, self.uid)
|
||||
|
||||
def _change_touch_mode(self, *largs):
|
||||
if not self._touch:
|
||||
|
@ -287,10 +287,11 @@ class ScrollView(StencilView):
|
|||
return False
|
||||
|
||||
def on_touch_down(self, touch):
|
||||
if not self.collide_point(*touch.pos):
|
||||
touch.ud[self._get_uid('svavoid')] = True
|
||||
return
|
||||
if self._touch:
|
||||
return super(ScrollView, self).on_touch_down(touch)
|
||||
if not self.collide_point(*touch.pos):
|
||||
return
|
||||
# support scrolling !
|
||||
if self._viewport and 'button' in touch.profile and \
|
||||
touch.button.startswith('scroll'):
|
||||
|
@ -323,6 +324,8 @@ class ScrollView(StencilView):
|
|||
return True
|
||||
|
||||
def on_touch_move(self, touch):
|
||||
if self._get_uid('svavoid') in touch.ud:
|
||||
return
|
||||
if self._touch is not touch:
|
||||
super(ScrollView, self).on_touch_move(touch)
|
||||
return self._get_uid() in touch.ud
|
||||
|
@ -370,6 +373,10 @@ class ScrollView(StencilView):
|
|||
# never ungrabed, cause their on_touch_up will be never called.
|
||||
# base.py: the me.grab_list[:] => it's a copy, and we are already
|
||||
# iterate on it.
|
||||
|
||||
if self._get_uid('svavoid') in touch.ud:
|
||||
return
|
||||
|
||||
if 'button' in touch.profile and not touch.button.startswith('scroll'):
|
||||
self._scroll_y_mouse = self.scroll_y
|
||||
|
||||
|
@ -385,7 +392,7 @@ class ScrollView(StencilView):
|
|||
elif self.auto_scroll:
|
||||
self._do_animation(touch)
|
||||
else:
|
||||
if self._touch is not touch:
|
||||
if self._touch is not touch and self.uid not in touch.ud:
|
||||
super(ScrollView, self).on_touch_up(touch)
|
||||
|
||||
# if we do mouse scrolling, always accept it
|
||||
|
|
Loading…
Reference in New Issue