Change e.touches, e.targetTouches and e.changedTouch

Say I'm listening to touchstart , touchmove and touchend in a body element.

Let me know if I'm wrong, but I think e.touches same as e.targetTouches ? If so, how e.changedTouches change in relation to them?

I mean, with one touch at a given moment, I bring a touch and take it apart. In my experience, all three sensory variables are the same.

I need to send the analyzed data to the server, and it is redundant enough to send the same exact string three times, is there no way to send it once and programmatically play touchhevent on the server?

+45
javascript touch webkit
Aug 14 '11 at 9:24 a.m.
source share
1 answer

The following lists are available:

  • touches : a list of information for each finger currently touching the screen
  • targetTouches : Similar to touches, but filtered only for finger touch information that started in the same node
  • changedTouches : a list of information for each finger participating in the event (see below) To better understand what might be in these lists, we quickly turn to some examples.

They differ in the following pattern:

  • When I put my finger down, all three lists will have the same information. It will be in changedTouches , because putting your finger down is what caused the event
  • When I put my second finger down, the touches will have two elements, one for each finger. targetTouches will have two elements only if the finger was placed on the same node as the first finger. changedTouches will have information related to the second finger, because its what caused the event
  • If I put two fingers exactly at the same time, it could have two elements in changedTouches , one for each finger
  • If I translate my fingers, the only list that changes will be changedTouches and will contain information related to the number of fingers that has been moved (at least one).
  • When I lift my finger, it will be removed from touches , targetTouches and will appear in changedTouches , as this caused the event
  • Removing my last finger leaves touches and targetTouches blank, and changedTouches will contain information for the last finger
+140
Aug 29 2018-11-21T00:
source share



All Articles