diff --git a/src/calibre/gui2/viewer/gestures.py b/src/calibre/gui2/viewer/gestures.py index a787df7c1c..053d724b21 100644 --- a/src/calibre/gui2/viewer/gestures.py +++ b/src/calibre/gui2/viewer/gestures.py @@ -165,6 +165,7 @@ class GestureHandler(QObject): QObject.__init__(self, view) self.state = State() self.state.swiped.connect(self.handle_swipe) + self.state.tapped.connect(self.handle_tap) self.evmap = {QEvent.TouchBegin: 'start', QEvent.TouchUpdate: 'update', QEvent.TouchEnd: 'end'} # Ignore fake mouse events generated by the window system from touch @@ -220,3 +221,8 @@ class GestureHandler(QObject): func = {Left:'next_page', Right: 'previous_page', Up:'goto_previous_section', Down:'goto_next_section'}[direction] getattr(view, func)() + def handle_tap(self, tp): + view = self.parent() + threshold = view.width() / 3.0 + attr = 'previous' if tp.start_position.x() <= threshold else 'next' + getattr(view, '%s_page'%attr)()