kivy/kivy — pull request #1673 by matham (2013-12-05 02:04:43+00:00)
Title: Fix some scrollview issues

The first commit resolves a issue with the following code:

from kivy.app import runTouchApp
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout

Builder.load_string("""
:
Label:
text: 'Say cheese!'
size_hint_x: 0.8
RelativeLayout:
ScrollView:
scroll_type: ['bars']
Button:
text: 'Press me too.'
""")

class Test(BoxLayout):
pass

if __name__ == '__main__':
runTouchApp(Test())

Without the patch, a touch on the button is offset horizontally for each RelativeLayout because the scrollview calls touch.apply_transform_2d(self.to_widget) needlessly in _change_touch_mode. When calling _change_touch_mode from on_touch_down/move the touch is already local.

The second commit fixes an issue where scrolling would happen even if there's nothing to scroll and on_touch_move would crash with a division by zero error.