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 —

Suggestions, better solutions?


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
tX = touchEvent.offsetX
tY = touchEvent.offsetY

layerA.midX = tX
layerA.midY = tY

Working well on mobile and desktop

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: (click anywhere on the screen to move the layer).

Andrew Nalband

I like the pointer module

Read the entire post on Facebook