Commit e0026a38 authored by Taddeüs Kroes's avatar Taddeüs Kroes

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

parent ed7b4732
...@@ -45,16 +45,19 @@ class TransformationTracker(GestureTracker): ...@@ -45,16 +45,19 @@ class TransformationTracker(GestureTracker):
self.update_centroid() self.update_centroid()
def on_point_move(self, point): def on_point_move(self, point):
if len(self.points) > 1: l = len(self.points)
if l > 1:
# Rotation (around the previous centroid) # Rotation (around the previous centroid)
if self.is_type_bound('rotate'): 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)) self.trigger(RotationGesture(self.centroid, rotation))
# Scale # Scale
if self.is_type_bound('pinch'): if self.is_type_bound('pinch'):
prev = point.get_previous_position().distance_to(self.centroid) prev = point.get_previous_position().distance_to(self.centroid)
dist = point.distance_to(self.centroid) dist = point.distance_to(self.centroid)
dist = prev + (dist - prev) / l
scale = dist / prev scale = dist / prev
self.trigger(PinchGesture(self.centroid, scale)) self.trigger(PinchGesture(self.centroid, scale))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment