mirror of https://github.com/kivy/kivy.git
Merge pull request #5413 from matham/touch_sv
Don't pass touch to children when outside the sv.
This commit is contained in:
commit
3da6d16504
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue