Double tap/click interaction

I was building a double tap interaction to present zoom in/ zoom out features, but I found some problem as I used the variables to judge if the user is double tapping.

I wanna exclude the single tap condition, it means that only when user double tapping in short span, just like 500ms, can be judged as a double tap condition.

Here are the conditions:


I use After delay to manipulate the timer. Since AfterDelay can only be put on the parent layer, I set timer on the frame.

And on the picture object, I set the conditions and the zoom in/out action.
image

if tapTimes == 2 and 【timer】>0
 Set doubleTap to true
 Set tapTimes to 0
 Set timer to 0
if tapTimes == 2 and 【timer】==0
 Set doubleTap to false
 Set tapTimes to 0
 Set timer to 0

image

It looks not bad, but there’re still some problems:
I don’t know why some times it was judged as a double tap, although the interval between two taps is greater than the span I set.

2 posts were merged into an existing topic: I found that How to build interaction of zooming in and zooming out by double tapping/clicking

Heyo @jwliu – I’ve looked at the video and your screenshots, and I’m actually not sure if this is a bug or if something may be missing from the timing.

I’m checking in with our prototyping team to get more info. In the meantime, are you able to share a copy of the file this prototype is in? That would be super helpful for us.

If you can, please share edit access to a copy of the file to support-share@figma.com. I’ll check back in once I hear more on my end, but @-mention if you share a copy of the file to the address above.