[libhandy/wip/exalm/paginator-animate: 25/41] swipe-tracker: Add hdy_swipe_tracker_shift_position()



commit df35598d6c5afc4c0e08d9c3c2ce6483c7a52b3c
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Dec 24 16:38:08 2019 +0500

    swipe-tracker: Add hdy_swipe_tracker_shift_position()
    
    This will allow to handle position shifting changing during the swipe.
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org

 src/hdy-swipe-tracker-private.h |  3 +++
 src/hdy-swipe-tracker.c         | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/hdy-swipe-tracker-private.h b/src/hdy-swipe-tracker-private.h
index f268b27f..4e027d85 100644
--- a/src/hdy-swipe-tracker-private.h
+++ b/src/hdy-swipe-tracker-private.h
@@ -36,4 +36,7 @@ void             hdy_swipe_tracker_set_allow_mouse_drag (HdySwipeTracker *self,
 gboolean         hdy_swipe_tracker_captured_event (HdySwipeTracker *self,
                                                    GdkEvent        *event);
 
+void             hdy_swipe_tracker_shift_position (HdySwipeTracker *self,
+                                                   gdouble          delta);
+
 G_END_DECLS
diff --git a/src/hdy-swipe-tracker.c b/src/hdy-swipe-tracker.c
index 288bda54..f91fb00a 100644
--- a/src/hdy-swipe-tracker.c
+++ b/src/hdy-swipe-tracker.c
@@ -904,6 +904,17 @@ hdy_swipe_tracker_captured_event (HdySwipeTracker *self,
     reset (self);
     return GDK_EVENT_STOP;
   }
-
   return retval;
 }
+
+void
+hdy_swipe_tracker_shift_position (HdySwipeTracker *self,
+                                  gdouble          delta)
+{
+  if (self->state != HDY_SWIPE_TRACKER_STATE_PENDING &&
+      self->state != HDY_SWIPE_TRACKER_STATE_SCROLLING)
+    return;
+
+  self->progress += delta;
+  self->initial_progress += delta;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]