Is there a quick / simple way to capture click position on mobile safari? event.x only seems to work on desktop framer / chrome. Basically I want:
Thing.on Events.Click, -> print "Click Position X:" + event.x
Where instead of event, something that actually works
not tested for mobile
doesn't work on mobile. i only need something that works on mobile ;-)
it's the touch position you're looking for
the thing you want is in the touches array of the event
touchEvent = Events.touchEvent eventtouchEvent.clientX
this is how draggable does it
With touch on mobile you get multiple positions, because you can have multiple fingers touching the screen. You can loop through event.touches and grab the first one
btw most of my framer questions are generally answered in the source code
Yeah, but this one threw me off the first time too.
interesting. since that only works for touch (for example, in studio, that prints out the x including the scale value), I'm finding I need to write an if isMobile to capture them differently.
^ That took me forever to find when I needed it. Is it documented anywhere?
I use this little helper function https://github.com/koenbok/Framer/blob/master/framer/Events.coffee#L36
I use a little helper like this: http://cl.ly/ZIkN
Amy: we rely on the standard browser events (for now) so not really in the Framer docs. Maybe I should add something for that until we roll our own sanitized events.
I agree Koen you should mention it until you roll your own... it's not clear what the path is... since everything is mostly rolled out by you guys, then in this one instance it's not... it's a bit frustrating. I've seen a few people hit this and come to me with questions about it.
In my experience, page[X/Y] work on mobile. The position will be from [0, 0] starting from the top left side of the screen.
Layer.on Events.TouchStart, -> print "Click Position:" + event.pageX