Skip to content

Commit 680c989

Browse files
committed
GestureController: Add jump method
1 parent b3d76f1 commit 680c989

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

lib/Gestures/GestureController.vala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,18 @@ public class Gala.GestureController : Object {
302302
finish ((to > progress ? 1 : -1) * 1, to);
303303
}
304304

305+
public void jump (double to) {
306+
if (running && !recognizing) {
307+
/* We are animating to a snap point so stop the animation */
308+
finished ();
309+
}
310+
311+
var clamped_to = to.clamp ((int) overshoot_lower_clamp, (int) overshoot_upper_clamp);
312+
313+
target?.propagate (COMMIT, action, clamped_to);
314+
progress = clamped_to;
315+
}
316+
305317
public void cancel_gesture () {
306318
if (recognizing) {
307319
recognizing_backend.cancel_gesture ();

0 commit comments

Comments
 (0)