TouchDispatcher.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:pythonista-scripts 作者: khilnani 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号