With Framer Studio, I'm trying to replicate the iOS Messages App's "select text" feature as seen below:
Particularly, I want the zoomed in bubble to show up on any location when I press and hold.
With Framer Studio, I'm trying to replicate the iOS Messages App's "select text" feature as seen below:
Particularly, I want the zoomed in bubble to show up on any location when I press and hold.
Here is an example Chris Aga posted in the Framer.js Facebook group: http://share.framerjs.com/78aqs01eogh9/
So what you want to do is, first check for longpress:
screen.on Events.TouchStart, (event) ->
isHeld = true
Utils.delay .25, () ->
if isHeld then triggerLongHold(event)
To normalize mouse and touch event coordinates we're using the Pointer Module. So you'll need to include the module in your project. After that move the magnifying glass layer to wherever the long press is happening:
triggerLongHold = (event) ->
mask.opacity = 1
shadow.opacity = 1
pointerValues = Pointer.screen(event, screen)
mask.x = pointerValues.x - mask.width / 2
mask.y = pointerValues.y - mask.height
bgMagnified.x = -2 * pointerValues.x + 140
bgMagnified.y = -2 * pointerValues.y + 120
and update its position if the user moves the finger/mouse:
screen.on Events.TouchMove, (event) ->
if isHeld
pointerValues = Pointer.screen(event, screen)
mask.x = pointerValues.x - mask.width / 2
mask.y = pointerValues.y - mask.height
bgMagnified.x = -2 * pointerValues.x + 140
bgMagnified.y = -2 * pointerValues.y + 120
Hope this will get you started!