zingtouch
zingtouch copied to clipboard
Detect swipe from edges of the region/element?
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 :)
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.