Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use a timer for an explicit timeout of 0 #1146

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Oct 12, 2017

  1. Do not use a timer for an explicit timeout of 0

    The `Press` gesture recognizer in HammerJS has problems consistently firing a `pressup` event following a `press` event in the context of small `time` values. This is well-known. See e.g. hammerjs#1011, hammerjs#836, hammerjs#751.
    
    We've found that given a pair of `Press` and `Pan` gestures configured as below, the `pressup` event will fairly consistently break ( especially when using touch input ).
    This particular scenario is used for detecting a `Press` for instant setting of a position and `Pan` gradually controlling a set position ( we specifically use this for creating a "dual-ended between" variant of the `input type="range"` ):
    
    ```js
    {
      recognizers : [
        [ Hammer.Pan, {
          direction : Hammer.DIRECTION_HORIZONTAL,
          threshold : 0
        }],
        [ Hammer.Press, {
          threshold : 1,
          time      : 0
        }]
       ]
    }```
    
    The root cause is with a granularity problem with browser timeouts as used in the `setTimeoutContext`, which causes part of the gesture logic to fire too late (or not at all). This issue and probably others like it, such as hammerjs#1011, hammerjs#836 or hammerjs#751 can be fixed by not using a timeout at all if the gesture's `time` property is 0.
    cduivis authored Oct 12, 2017
    Configuration menu
    Copy the full SHA
    78011d1 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2017

  1. Configuration menu
    Copy the full SHA
    9b1e9da View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e178bb1 View commit details
    Browse the repository at this point in the history