Skip to content
Snippets Groups Projects
Commit e0026a38 authored by Taddeüs Kroes's avatar Taddeüs Kroes
Browse files

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

parent ed7b4732
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment