How I can make this spots in center of globe(different levels) to open level screen on tapping. But also able to drag/swipe over spot button area for handling rotation of globe menu without triggering to changing level screen.
I don’t understand the question. Could you please elaborate a bit on what you want?
My interpretation is: “How do I differentiate input intended for dragging the world as opposed to tapping to enter a level?”
I would track the time between press and release, if it is long then the user intended to drag. If it is short, the user intended to tap.
On press:
Start a counter
While pressed:
Do dragging
On release:
If the time between press and release is short, trigger a level (if release was on the level)
1 Like
I would do one of these:
- Track position of
pressed
event. Track position ofreleased
event. If the distance between the two are larger than say 20px then it’s a drag. - Track position of
pressed
event. Continuously track position of mouse/touch event. Calculate distance between pressed event and current event. If the distance goes above 20px set adragging = true
flag. When you get areleased
event you check ifdragging
is true or false and treat the released event accordingly.
2 Likes
Yes, Applied the same tracking position(first one). Made it work. By this way it work with swipe gesture also.
1 Like