zingtouch icon indicating copy to clipboard operation
zingtouch copied to clipboard

Detect swipe from edges of the region/element?

Open diegoversiani opened this issue 6 years ago • 1 comments

Hi,

I'm looking for a way to detect a swipe event from the left edge of the users screen to open an offside menu.

I only get one event in e.detail.events for the touchend event so I can't test if the swipe gesture started at let say < 15px from the edge:

detail:
  data:
    Array(1) 0:
      - currentDirection: 360,
      - velocity: 3.9670588235294115
  events:
    Array(1) 0:
      - l {originalEvent: TouchEvent, type: "end", x: 356.97698974609375, y: 259.302001953125, clientX: 356.97698974609375, …}

Does the library support this scenario?

Thanks in advance :)

diegoversiani avatar Aug 26 '17 10:08 diegoversiani

I found this library very helpful for managing complicated touch events.

From memory I can't remember if the swipe start event is accessible from the swipe end event. I am inclined to say it is. If it's not, you can easily store the coordinates from the swipe start event in a variable and then access the variable in the swipe end.

1ubuntuuser avatar Dec 19 '17 20:12 1ubuntuuser