def touch_ended(self,touch):
# dispatch whatever is under the touch
# for multitouch probably only want to execute when there are no active touches left.
# this method would need to clean out touches, but still keep info on the active gesture. when there are no active touches left, then kill the gesture
# for now.... just look under the touch, and call something appropriate.
# need to handle each ui type!
#print self.name, 'touch ended'
for s in self.subviews:
#probably need to check whether another view is on top...
if TouchDispatcher.hit(s,ui.convert_point(touch.location,self,s)):
if isinstance(s,ui.TextField):
#print '..textfield begin editing'
s.begin_editing()
#think about setting cursor.... HARD! but possible i think?
elif isinstance(s, ui.Button):
#print '..button launch'
s.action(s)
elif isinstance(s, TouchDispatcher):
# adjust touch location to subviews coordinates, then dispatch
# print '..touch end: dispatch: ', s.name
t=Touch(touch)
t.location=ui.convert_point(touch.location,self,s)
s.touch_ended(t)
评论列表
文章目录