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

What is Framer? Join the Community
Return to index
Angus Zhu
Posted Nov 30 - Read on Facebook

I am using Framer with Hammer, how can I get the touch position on a certain layer? Assuming coordinate (0,0) is the top left corner of the layer.

5 Comments

Seoh Char

hammer.on "tap press", (ev) ->
ev = ev.pointers[0]
print ev.offsetX

Angus Zhu

Hi Seoh Char, could you be more specific? Because I am not seeing "pointers" in the event object. Thanks

Angus Zhu

Seoh Char

oh, got it. "gesture" property means you used hammerjs version less than 2.0. if it is right, you could get offset(relative position within target Element) like this

print event.gesture.srcEvent.offsetX

Angus Zhu

That works for me. Thank you so much, Seoh Char!

Read the entire post on Facebook