Przeglądaj źródła

Fixed transformation trackers by incorporating division by number of touch points.

Taddeus Kroes 13 lat temu
rodzic
commit
e0026a3874
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      src/trackers/transform.py

+ 5 - 2
src/trackers/transform.py

@@ -45,16 +45,19 @@ class TransformationTracker(GestureTracker):
         self.update_centroid()
 
     def on_point_move(self, point):
-        if len(self.points) > 1:
+        l = len(self.points)
+
+        if l > 1:
             # Rotation (around the previous centroid)
             if self.is_type_bound('rotate'):
-                rotation = point.rotation_around(self.centroid)
+                rotation = point.rotation_around(self.centroid) / l
                 self.trigger(RotationGesture(self.centroid, rotation))
 
             # Scale
             if self.is_type_bound('pinch'):
                 prev = point.get_previous_position().distance_to(self.centroid)
                 dist = point.distance_to(self.centroid)
+                dist = prev + (dist - prev) / l
                 scale = dist / prev
                 self.trigger(PinchGesture(self.centroid, scale))