mirror of https://github.com/kivy/kivy.git
Minor code documentation and whitespace
This commit is contained in:
parent
650e539631
commit
cc376d931b
|
@ -9,10 +9,10 @@ class BezierTest(FloatLayout):
|
|||
|
||||
def __init__(self, points=[], loop=False, *args, **kwargs):
|
||||
super(BezierTest, self).__init__(*args, **kwargs)
|
||||
self.d = 10
|
||||
self.d = 10 # pixel tolerance when clicking on a point
|
||||
self.points = points
|
||||
self.loop = loop
|
||||
self.current_point = None
|
||||
self.current_point = None # index of point being dragged
|
||||
|
||||
with self.canvas:
|
||||
Color(1.0, 0.0, 0.0)
|
||||
|
@ -51,9 +51,8 @@ class BezierTest(FloatLayout):
|
|||
def on_touch_down(self, touch):
|
||||
if self.collide_point(touch.pos[0], touch.pos[1]):
|
||||
for i, p in enumerate(list(zip(self.points[::2], self.points[1::2]))):
|
||||
if (
|
||||
abs(touch.pos[0] - self.pos[0] - p[0]) < self.d and
|
||||
abs(touch.pos[1] - self.pos[1] - p[1]) < self.d):
|
||||
if ( abs(touch.pos[0] - self.pos[0] - p[0]) < self.d and
|
||||
abs(touch.pos[1] - self.pos[1] - p[1]) < self.d):
|
||||
self.current_point = i + 1
|
||||
return True
|
||||
return super(BezierTest, self).on_touch_down(touch)
|
||||
|
|
Loading…
Reference in New Issue