hwhw/kindlepdfviewer — pull request #634 by houqp (2012-11-24 17:11:25+00:00)
Title: Touch gesture detection module

I am lazy, so I just copied the design from Firefox OS:

https://github.com/mozilla-b2g/gaia/blob/master/shared/js/gesture_detector.js

Basically it's just state machine. State is changed according to the touch input.

I added a scheduler in inputevent.lua module so sorry that we have two scheduler now (another in ui.lua). Because I need to simulate the setTimeOut function in Javascript during the gesture detection, so this is the only way I can think of so far. Maybe we can clean it up later. Also to help with the detection and scheduling, I also added a time.lua module which abstract the operations on time values.

Currently, only single tap, double tap and hold gesture is supported. Since single tap is enough to handle most of the operations we need during reading, I decide to stop developing for new gestures but switch back to more important part of the reader.

If you want to test it but you don't have kindle Touch, you can try it in emulator. Mouse click is translated into touch events.

Of course this is just one possible solution for touch support, feel free to come up with any better implementation :)