This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Christy Yang
Posted Nov 11 - Read on Facebook

Hi all,

I apologize if this question has been asked before...but I scrolled through and can't seem to find a solution. I am building a prototype where if someone taps at a map, it opens or closes...but if they drag the map it will allow them to pan and move it around.

Is there a way where I can make the prototype differentiate between TouchStart, TouchEnd, Draggable in a foolproof way? As of now, when I let go of the draggable it closes on me.

Thanks in advance!

6 Comments

Johannes Eckert

I guess there are also DragStart and DragEnd, which also get fired the moment you touch the screen or release the finger. I guess you are closing the map on TouchEnd? Make that DragEnd, and then I'm thinking of it this way:

On DragStart (which should be fired when as soon as you touch the screen), set a mapHasMoved variable to false.
On DragMove set mapHasMoved variable to true
On DragEnd, check mapHasMoved and then close the map if it's still false

This should work with TouchStart/End, too

Christy Yang

Thank you I will try that!

Christy Yang

If I'm reading it correctly however, you've assumed that I want the map to close on either TouchEnd or DragEnd. I only want the map to close when the user lets go of the dragging, and then taps it again to close. Does this still work?

Johannes Eckert

as far as I know a tap on the map would fire a DragStart when touching the screen and DragEnd when releasing the finger. This is actually the trick: You set the variable to false on DragStart and since DragMove doesn't occur is stays false when DragEnd occurs

Johannes Eckert

… when the user drags and let go, hasMapMoved will be true (set by DragMove). This way touching, moving and releasing doesn't close the app, but touching and releasing does

Christy Yang

Thank you! I will try it tomorrow at work :)

Read the entire post on Facebook