Permalink
Browse files

Add a minimum finger distance

A sane minimum for finger distance so that we can never have events where fingers overlay exactly, messing up scale and rotation.
  • Loading branch information...
koenbok committed Feb 3, 2016
1 parent a23f2cd commit 9876ddd0b025db5f67b8140295351a563c697528
Showing with 3 additions and 2 deletions.
  1. +3 −2 framer/GestureInputRecognizer.coffee
@@ -8,6 +8,7 @@ GestureInputVelocityTime = 0.1
GestureInputForceTapDesktop = MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN
GestureInputForceTapMobile = 0.7
GestureInputForceTapMobilePollTime = 1/30
GestureInputMinimumFingerDistance = 30
{DOMEventManager} = require "./DOMEventManager"
@@ -287,7 +288,7 @@ class exports.GestureInputRecognizer
if @session.started.pinch and event.fingers == 1
@pinchend(event)
# If we did not start yet and get two fingers, start
else if not @session.started.pinch and event.fingers == 2
else if not @session.started.pinch and event.fingers == 2
@pinchstart(event)
# If we did start send pinch events
else if @session.started.pinch
@@ -363,7 +364,7 @@ class exports.GestureInputRecognizer
touchPointB = @_getTouchPoint(event, 1)
event.touchCenter = Utils.pointCenter(touchPointB, touchPointA)
event.touchOffset = Utils.pointSubtract(touchPointB, touchPointA)
event.touchDistance = Utils.pointDistance(touchPointA, touchPointB)
event.touchDistance = _.max([GestureInputMinimumFingerDistance, Utils.pointDistance(touchPointA, touchPointB)])
event.rotation = Utils.pointAngle(touchPointA, touchPointB)
# Special cases

0 comments on commit 9876ddd

Please sign in to comment.