Commit 9c260769 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Flick should be fixed now (TEST ON TABLE\!).

parent 55dbb2eb
......@@ -111,8 +111,9 @@ class TransformationTracker(GestureTracker):
def update_centroid(self):
if not self.points:
prev = self.centroid
self.centroid = None
return
return prev
# Calculate average touch point coordinates
l = len(self.points)
......@@ -124,6 +125,7 @@ class TransformationTracker(GestureTracker):
# Update centroid positionable
if self.centroid:
self.centroid.set_position(x, y)
return self.centroid.prev
else:
self.centroid = MovingPositionable(x, y)
......@@ -176,13 +178,14 @@ class TransformationTracker(GestureTracker):
self.centroid.translation(), l))
def on_point_up(self, event):
if event.point in self.points:
self.points.remove(event.point)
point = event.get_touch_object()
if point in self.points:
self.points.remove(point)
prev = self.update_centroid()
if not self.points:
self.trigger(FlickGesture(event, self.centroid,
self.centroid.translation()))
self.update_centroid()
self.trigger(FlickGesture(event, point, point - prev))
if not self.propagate_events:
event.stop_propagation()
......
......@@ -63,9 +63,14 @@ class Polygon(BoundingBoxArea):
self.flick_direction = trans
flicks.add(Flick(self.flick_drag, 0.7, 0.4))
def margin_contains(self, x, y):
m = self.margin
return self.x - m <= x < self.x + self.width + m \
and self.y - m <= y < self.y + self.height + m
def contains(self, x, y):
if draw_bounding_boxes:
return mt.RectangularArea.contains(self, x, y)
return self.margin_contains(self, x, y)
return BoundingBoxArea.contains(self, x, y)
......@@ -86,11 +91,6 @@ class Polygon(BoundingBoxArea):
self.update_bounds()
refresh()
#def contains(self, x, y):
# m = self.margin
# return self.x - m <= x < self.x + self.width + m \
# and self.y - m <= y < self.y + self.height + m
def draw(self, cr):
# Draw bounding box
if draw_bounding_boxes:
......
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