basic.py 731 B

12345678910111213141516171819202122232425262728293031
  1. from ..tracker import GestureTracker
  2. from utils import PointGesture
  3. class DownGesture(PointGesture):
  4. _type = 'point_down'
  5. class MoveGesture(PointGesture):
  6. _type = 'point_move'
  7. class UpGesture(PointGesture):
  8. _type = 'point_up'
  9. class BasicEventTracker(GestureTracker):
  10. """
  11. The main goal of this class is to provide a triggering mechanism for the
  12. low-level point-down, point-move and point-up events.
  13. """
  14. supported_gestures = [DownGesture, MoveGesture, UpGesture]
  15. def on_point_down(self, event):
  16. self.trigger(DownGesture(event))
  17. def on_point_move(self, event):
  18. self.trigger(MoveGesture(event))
  19. def on_point_up(self, event):
  20. self.trigger(UpGesture(event))