Skip to content
Permalink
Browse files

Merge branch 'master' of github.com:koenbok/Framer

  • Loading branch information
koenbok committed Apr 4, 2016
2 parents 5c1930f + 6ac6021 commit 6e5fe805458bc1e760e6577f040c0a9bb035d1e5
Showing with 11 additions and 17 deletions.
  1. +10 −16 framer/GestureInputRecognizer.coffee
  2. +1 −1 framer/LayerPinchable.coffee
@@ -12,22 +12,16 @@ GestureInputMinimumFingerDistance = 30

{DOMEventManager} = require "./DOMEventManager"

TouchStart = "touchstart"
TouchMove = "touchmove"
TouchEnd = "touchend"

# Fixme: this breaks pinch

# if not Utils.isTouch()
# TouchStart = "mousedown"
# TouchMove = "mousemove"
# TouchEnd = "mouseup"
TouchStart = ["touchstart", "mousedown"]
TouchMove = ["touchmove", "mousemove"]
TouchEnd = ["touchend", "mouseup"]

class exports.GestureInputRecognizer

constructor: ->
@em = new DOMEventManager()
@em.wrap(window).addEventListener(TouchStart, @touchstart)

TouchStart.map (e) => @em.wrap(window).addEventListener(e, @touchstart)

destroy: ->
@em.removeAllListeners()
@@ -41,8 +35,8 @@ class exports.GestureInputRecognizer
# Only fire if we are not already in a session
return if @session

@em.wrap(window).addEventListener(TouchMove, @touchmove)
@em.wrap(window).addEventListener(TouchEnd, @touchend)
TouchMove.map (e) => @em.wrap(window).addEventListener(e, @touchmove)
TouchEnd.map (e) => @em.wrap(window).addEventListener(e, @touchend)
@em.wrap(window).addEventListener("webkitmouseforcechanged", @_updateMacForce)

@session =
@@ -80,9 +74,9 @@ class exports.GestureInputRecognizer
else
return unless (event.touches.length == event.changedTouches.length)

@em.wrap(window).removeEventListener(TouchMove, @touchmove)
@em.wrap(window).removeEventListener(TouchEnd, @touchend)
@em.wrap(window).removeEventListener("webkitmouseforcechanged", @_updateMacForce)
TouchMove.map (e) => @em.wrap(window).removeEventListener(e, @touchmove)
TouchEnd.map (e) => @em.wrap(window).removeEventListener(e, @touchend)
@em.wrap(window).addEventListener("webkitmouseforcechanged", @_updateMacForce)

event = @_getGestureEvent(event)

@@ -73,7 +73,7 @@ class exports.LayerPinchable extends BaseClass

_pinch: (event) =>

return unless event.touches.length is 2
return unless event.fingers is 2
return unless @enabled

pointA =

0 comments on commit 6e5fe80

Please sign in to comment.
You can’t perform that action at this time.