Permalink
Browse files

Only fire tap events if we don’t and a session of another sort with a…

… touchend
  • Loading branch information...
nvh committed Feb 16, 2018
1 parent 454aef4 commit 64a7037ea89e6c996359fc9c4611a69689c19154
Showing with 17 additions and 9 deletions.
  1. +17 −9 framer/GestureInputRecognizer.coffee
@@ -88,16 +88,24 @@ class exports.GestureInputRecognizer
event = @_getGestureEvent(event)
# TODO: base cancel click on how iOS handles it:
# - session no longer than 0.75 seconds
# - no more movement more than 45 points
fireTapEvent = true
for eventName, value of @session.started
@["#{eventName}end"](event) if value
# We only want to fire a tap event if the original target is the same
# as the release target, so buttons work the way you expect if you
# release the mouse outside.
if not @session?.startEvent
@tap(event)
else if @session.startEvent.target is event.target
@tap(event)
if value
# Do not fire a tap event if we are ending another events session
fireTapEvent = false
@["#{eventName}end"](event)
if fireTapEvent
# We only want to fire a tap event if the original target is the same
# as the release target, so buttons work the way you expect if you
# release the mouse outside.
if not @session?.startEvent
@tap(event)
else if @session.startEvent.target is event.target
@tap(event)
@tapend(event)
@cancel()

0 comments on commit 64a7037

Please sign in to comment.