I am trying to create a HTML5 web application for iPhone. I am using jQuery Mobile for it. My application involves drawing in canvas. It is much like a paint application that utilizes the canvas for rendering the sketch. A user can swipe across the screen from any direction and the app should be able to figure out the positions and then draw line across the points.
jQuery Mobile provides only some of the following basic event for the swipe control but I think I need some more control over the swipe since user can swipe in any direction and can be any pixel long. On the other hand I should be able to capture most of the points so that I could visualize the drawing more clearly and precisely.
tap
Triggers after a quick, complete touch event.
taphold
Triggers after a held complete touch event (close to one second).
swipe
Triggers when a horizontal drag of 30px or more (and less than 20px vertically) occurs within 1 second duration.
swipeleft
Triggers when a swipe event occurred moving in the left direction.
swiperight
Triggers when a swipe event occurred moving in the right direction.
Is there any other techniques that I should follow to create a drawing application in the canvas for iOs applications? Any help will be appreciated.
Some events you missed on the Event page of the jQuery Mobile Documentation are the virtual events: http://jquerymobile.com/demos/1.0/docs/api/events.html
I would use the
vmousedownevent to start tracking the cursor’s movement,vmousemoveto continue tracking the path of the cursor, andvmouseupto finish tracking the cursor’s movement.A simple example would be: