Reprint Address: http://www.cnblogs.com/pifoo/archive/2011/05/22/webkit-touch-event-3.html
This article focuses on the gesture event (Android and iOS) that are unique to the multiple-touch devices. This one
The event is a higher-level package for the touch event, and like a touch, it also includes Gesturestart,gesturechange,
Gestureend Three event callbacks:
?
Gesturestart///When two or more fingers are placed on the screen to trigger the Gesturechange//when there are two or more fingers on the screen, and when the fingers are moving, trigger the gestureend//when the last second finger is lifted, the end of G Esture |
An gestureevent type parameter is obtained in the event handler, which contains the scale of the finger (the proportion of the two root movement separated
Information and rotation (the angle of the line rotation between the two fingers).
When two or more fingers are active on the screen, we can make some more complex gestures. It's going to involve ordinary mouse.
Pieces, touch events and gesture events are more complex. Touch has been described in detail in the first article, and here it is easy to carry.
Let's take a look at what happens when you put two fingers on the screen separately:
1, the first finger down, triggering touchstart, nothing else will happen (please refer to the second article, the finger lift will trigger
The events of the mouse)
2, the second finger down, triggering gesturestart
3, trigger the second finger of the Touchstart
4, immediately trigger Gesturechange
5, the finger moves, continues to trigger the gesturechange, just like the mouse when moving on the screen to trigger MouseMove
6, the second finger lift, trigger gestureend, will not trigger Gesturechange
7, trigger the second finger of the touchend
8, triggering touchstart. Note, as described in the first article, multiple fingers on the screen, lifting one, will refresh the global
Touch. The touchstart that triggers the first finger is different from what Apple describes on the official website.
9, lift the first finger, trigger touchend
The handling of gesture events is similar to the touch, and we usually use the information in the Gestureevent object in Gesturechange to
Do some things:
?
var angle = event.rotation; Var |