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

What is Framer? Join the Community
Return to index
Nikolay Berezovskiy
Posted May 11 - Read on Facebook

Hi, guys. Here is the creepy workaround which helps you get the real pointer coordinates from touch event on your Device, not Canvas — http://share.framerjs.com/1cgf43ahlljq

Suggestions, better solutions?

3 Comments

Pavel Laptev

Николай Березовский try this

bg.on Events.Click, (event, layer) ->

touchEvent = Events.touchEvent(event)

if Utils.isPhone() || Utils.isTablet()
tX = touchEvent.clientX - layer.x
tY = touchEvent.clientY - layer.y
else
tX = touchEvent.offsetX
tY = touchEvent.offsetY

layerA.midX = tX
layerA.midY = tY

Working well on mobile and desktop

https://www.dropbox.com/s/85027s0anhkhstt/touchCoordinate2.framer.zip?dl=0

Benjamin Den Boer

Hey Nikolay Berezovskiy — you can also use the convertPointFromContext Utility. It takes for arguments: point = {}, layer, rootContext=false, includeLayer=true. A point (say, click event point), a layer, whether or not to make it cross from the top context and whether or not to include the layer. Here's a little example: http://share.framerjs.com/y9xwkxnpn6zu/ (click anywhere on the screen to move the layer).

Andrew Nalband

I like the pointer module

Read the entire post on Facebook