diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-01-04 22:02:23 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-01-04 22:02:23 (GMT) |
commit | 9263b5c8e7c4109cb2660ab77777feb3ab39d765 (patch) | |
tree | ddc6fae1737914e99262bf150b834df636f55a22 | |
parent | d4bb09ec71420d3e4fc544beb03ff0401b5e20fe (diff) |
added motion threshold to distinguish between a click and a drag when using touch
-rw-r--r-- | TurtleArt/tawindow.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 8a294ba..48d9acc 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -73,6 +73,8 @@ from sprites import Sprites, Sprite if GST_AVAILABLE: from tagplay import stop_media +MOTION_THRESHOLD = 4 + class TurtleArtWindow(): """ TurtleArt Window class abstraction """ @@ -1548,7 +1550,7 @@ class TurtleArtWindow(): dx = x - dragx - sx dy = y - dragy - sy - # Take no action if there was a move of 0,0. + # Take no action if there was a move of 0, 0. if dx == 0 and dy == 0: return @@ -1730,7 +1732,11 @@ class TurtleArtWindow(): self.drag_group = None # Find the block we clicked on and process it. - if self.block_operation == 'click': + # Consider a very small move a click (for touch interfaces) + if self.block_operation == 'click' or \ + (self.hw == XO175 and self.block_operation == 'move' and ( + abs(self.dx) < MOTION_THRESHOLD and \ + abs(self.dy < MOTION_THRESHOLD))): self._click_block(x, y) def remote_turtle(self, name): |