Skip to content

Commit ef10f10

Browse files
committed
Prevent overshoot
1 parent f0516ac commit ef10f10

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Gestures/PanBackend.vala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ public class Gala.PanBackend : Object {
5050
}
5151

5252
private void on_gesture_end () {
53-
direction = GestureDirection.UNKNOWN;
54-
5553
float x_coord, y_coord;
5654
pan_action.get_motion_coords (0, out x_coord, out y_coord);
5755
on_end (calculate_percentage (x_coord, y_coord), pan_action.get_last_event (0).get_time ());
56+
57+
direction = GestureDirection.UNKNOWN;
5858
}
5959

6060
private bool on_pan (Clutter.PanAction pan_action, Clutter.Actor actor, bool interpolate) {
@@ -71,11 +71,11 @@ public class Gala.PanBackend : Object {
7171
private double calculate_percentage (float current_x, float current_y) {
7272
float current, origin, size;
7373
if (pan_axis == X_AXIS) {
74-
current = current_x;
74+
current = direction == RIGHT ? float.max (current_x, origin_x) : float.min (current_x, origin_x);
7575
origin = origin_x;
7676
size = travel_distances != null ? travel_distances.width : actor.width;
7777
} else {
78-
current = current_y;
78+
current = direction == DOWN ? float.max (current_y, origin_y) : float.min (current_y, origin_y);
7979
origin = origin_y;
8080
size = travel_distances != null ? travel_distances.height : actor.height;
8181
}

0 commit comments

Comments
 (0)