Example #1
0
 def on_touch(self, xy, action):
     """distribute touch events to relevant widgets, offset relative to each widget"""
     if action == 'down':
         for hit_area in self.hit_areas:
             if hit_area.rect.collidepoint(xy):
                 self.active_hit_areas.append(hit_area)
                 pos = _xy_subtract(xy, hit_area.rect.topleft)
                 hit_area.callback(pos, 'down')
     elif action in ('move', 'drag', 'up', 'drag_up'):
         for hit_area in self.active_hit_areas:
             pos = _xy_subtract(xy, hit_area.rect.topleft)
             hit_area.callback(pos, action)
     if action in ('up','drag_up'):
         self.active_hit_areas[:] = []
Example #2
0
 def get_abs_position(self):
     if hasattr(self.parent, "position"):
         return _xy_subtract(self.parent.get_abs_position(),
                             self.parent.position)
     else:  #pragma: no cover can't think of any way to test this currently
         return self.parent.get_abs_position()
Example #3
0
 def get_abs_position(self):
     if hasattr(self.parent, "position"):
         return _xy_subtract(self.parent.get_abs_position(), self.parent.position)
     else: #pragma: no cover can't think of any way to test this currently
         return self.parent.get_abs_position()