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

What is Framer? Join the Community
Return to index
Aaron Paterson
Posted Sep 01 - Read on Facebook

http://share.framerjs.com/hiett9y2a6w5/

Hey guys and Gals, I was having some fun this past few weeks with this built from Sketch 3. It's the beginning of an interaction tool for kids. I'm having a hard with the pupil not changing sizes while tapping. I added the:

# Only click on tap
moving = false
layerB.on Events.TouchMove, ->
moving = true

# Must be above of TouchEnd/DragEnd
layerB.on Events.Click, ->
# print "Click!" if not moving

layerB.on Events.TouchEnd, ->
moving = false

but doesn't seem to be working?

Not sure what I'm doing wrong because in a browser it work kinda as intended better than the mirrored Mobile version?

6 Comments

Moni Zhuang

Try this.
----code----
layerB.on Events.Drag, ->
__ layerB.ignoreEvents=true

dragHappened = false
layerB.on Events.DragMove, ->
__dragHappened = true

layerB.on Events.DragEnd, ->
__if dragHappened
____dragHappened = false
____layerB.ignoreEvents=false
----please delete the underline----

I think "layerB.ignoreEvents=true" will be useful. But when I try this, I found something wrong with the DragEnd Event. DragEnd is fired several times. So I add another parameter "dragHappened". Maybe this is not a prefect solution, but it really works.
I hope it helps!

Aaron Paterson

Ok great i'll try it . Glad you liked it. 😀 cheers

Aaron Paterson

Hi, Moni can you send it again without the underscore. please If you can use 'tabs' great.

Also do i have to leave this code: and add your code below it?

# Only click on tap
moving = false
layerB.on Events.TouchMove, ->
moving = true

# Must be above of TouchEnd/DragEnd
layerB.on Events.Click, ->

# print "Click!" if not moving
layerB.on Events.TouchEnd, ->
moving = false

Aaron Paterson

It does work but there is still an Reference error - " can't find variable if" i'd rather clean code with no error. thanks I'll see what I can do to fix it.

Moni Zhuang

I shared the project, please check it. http://share.framerjs.com/05zyexxdeiiw/

Aaron Paterson

Ok ill Have a look at the code thanks

Read the entire post on Facebook