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

What is Framer? Join the Community
Return to index
Harry Brignull
Posted Mar 19 - Read on Facebook

I've written a framerjs script that uses click events on a draggable layer. I've noticed that the click events occur when the user does a drag and releases the cursor. Ideally I'd like a way for the release of a drag to not be detected as a click (i.e. clicks only occur when there is no drag event). I expect I'm just doing something wrong. Any advice?


Jacky Lee

Can you share your WIP and explain further on what's wrong with it? Sorry, to answer your woes, it would be easier if I know what you're trying to achieve here.

Harry Brignull

Thanks Jacky. I'll prepare something tidy and share it later on.

Koen Bok

I'm working on a nice solution for this.

Harry Brignull

Also - not sure if others need this but maybe some sort of gesture recognition engine that can be used to distinguish a vertical vs horizontal gesture (often used in content apps where the user can either read more of current page vertically vs swipe horizontally to next page)... but I'm getting ahead of myself as I can barely write basic coffeescript yet.

Andrew Nalband

Koen Bok - Looking forward to it!

Andrew Nalband

Harry Brignull - I've been storing the X and Y values of my touch events in global variables:

startx = null
starty = null
endx = null
endy = null

cardA.on Events.TouchStart, ->
startx = Events.touchEvent(event).clientX
starty = Events.touchEvent(event).clientY

cardA.on Events.TouchEnd, ->
endx = Events.touchEvent(event).clientX
endy = Events.touchEvent(event).clientY

Harry Brignull

Andrew - sounds like you're dealing with a different challenge to me. in my post above I was trying to work out how to prevent a click event from happening when a user does a drag.

Andrew Nalband

hmm, you might be looking for this, that Koen posted:

Harry Brignull

Perfect, thanks Andrew!

Read the entire post on Facebook