From 6f93debe6e545532199739ae9ffd2ac71348877c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 22 Aug 2016 10:02:29 +0530 Subject: [PATCH] Handle swiping in flow mode --- src/pyj/read_book/flow_mode.pyj | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/flow_mode.pyj b/src/pyj/read_book/flow_mode.pyj index 11a2ada306..401ebaf1eb 100644 --- a/src/pyj/read_book/flow_mode.pyj +++ b/src/pyj/read_book/flow_mode.pyj @@ -100,4 +100,12 @@ def layout(is_single_page): set_css(document.body, margin='0', border_width='0', padding='0') def handle_gesture(gesture): - pass + if gesture.type is 'swipe': + if gesture.points.length > 1 and not gesture.is_held: + delta = gesture.points[-2] - gesture.points[-1] + if gesture.axis is 'vertical': + scroll_by(delta) + else: + window.scrollBy(delta, 0) + if not gesture.active: + print('TODO: Implement momentum scrolling')