From 9263b5c8e7c4109cb2660ab77777feb3ab39d765 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Wed, 04 Jan 2012 22:02:23 +0000 Subject: added motion threshold to distinguish between a click and a drag when using touch --- (limited to 'TurtleArt') 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): -- cgit v0.9.1