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

requireFailure not working with doubletap #23

Open
mattmcdonald-uk opened this issue Jan 7, 2015 · 13 comments
Open

requireFailure not working with doubletap #23

mattmcdonald-uk opened this issue Jan 7, 2015 · 13 comments
Assignees
Labels
Milestone

Comments

@mattmcdonald-uk
Copy link

When you add requireFailure of doubletap you get a TypeError: "TypeError: Cannot read property 'requireFailure' of null at db.V.requireFailure".

Changing the requireFailure to swipe, pan, etc. all works.

<div id="trigger"
    hm-tap="onHammer"
    hm-doubletap="onHammer"
    hm-recognizer-options='[
        {"type":"singletap", "requireFailure":"doubletap"}
    ]' ></div>

Simillarly, using a recognizeWith of singletap also doesn't work.

This example from hammerjs shows the regular usage of these options: http://codepen.io/jtangelder/pen/pBuIw

@RyanMullins RyanMullins self-assigned this Jan 7, 2015
@RyanMullins RyanMullins added this to the v2.1.6 milestone Jan 7, 2015
@RyanMullins
Copy link
Owner

I'll take a look later this week. In a bit of a time crunch for some work-related stuff.

@RyanMullins
Copy link
Owner

Looking at that, there's a chance that the "requireFailure":"doubletap" is actually being applied to the double tap recognizer.

@mattmcdonald-uk
Copy link
Author

I get the same problem if I remove hm-doubletap from the element.

@mattmcdonald-uk
Copy link
Author

Still not working using v2.1.10.

Slightly different error: "TypeError: Cannot read property 'requireFailure' of null
at TapRecognizer.Recognizer.requireFailure "

@RyanMullins
Copy link
Owner

Looking into this now.

@RyanMullins
Copy link
Owner

If you want to track my work, I'm debugging this here: http://plnkr.co/edit/KwuQrxV2cFhnwRnBfZj3

@RyanMullins
Copy link
Owner

@mattmcdonald-uk Can you give me a more detailed error log? I'm having trouble reproducing this and I would like to see what line it's on/referencing.

@RyanMullins RyanMullins modified the milestones: 2.1.11, v2.1.10 Jan 15, 2015
@mattmcdonald-uk
Copy link
Author

Seeing the exact same issue in your plunker.

Error output from Chrome below:

TypeError: Cannot read property 'requireFailure' of null
at TapRecognizer.Recognizer.requireFailure (http://ryanmullins.github.io/angular-hammer/bower_components/hammerjs/hammer.js:1263:28)
at setupRecognizerWithOptions (http://ryanmullins.github.io/angular-hammer/angular.hammer.js:403:18)
at http://ryanmullins.github.io/angular-hammer/angular.hammer.js:199:19
at Object.forEach (http://ryanmullins.github.io/angular-hammer/bower_components/angular/angular.js:325:18)
at link (http://ryanmullins.github.io/angular-hammer/angular.hammer.js:184:23)
at nodeLinkFn (http://ryanmullins.github.io/angular-hammer/bower_components/angular/angular.js:6711:13)
at compositeLinkFn (http://ryanmullins.github.io/angular-hammer/bower_components/angular/angular.js:6105:13)
at nodeLinkFn (http://ryanmullins.github.io/angular-hammer/bower_components/angular/angular.js:6705:24)
at compositeLinkFn (http://ryanmullins.github.io/angular-hammer/bower_components/angular/angular.js:6105:13)
at compositeLinkFn (http://ryanmullins.github.io/angular-hammer/bower_components/angular/angular.js:6108:13) <div id="trigger" class="target" hm-tap="onHammer" hm-doubletap="onHammer" hm-recognizer-options="[{&quot;type&quot;:&quot;tap&quot;, &quot;requireFailure&quot;:&quot;doubletap&quot;}]" style="touch-action: manipulation; -webkit-user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">angular.js:10071 (anonymous function)angular.js:7364 (anonymous function)angular.js:6714 nodeLinkFnangular.js:6105 compositeLinkFnangular.js:6705 nodeLinkFnangular.js:6105 compositeLinkFnangular.js:6108 compositeLinkFnangular.js:6001 publicLinkFnangular.js:1449 (anonymous function)angular.js:12701 Scope.$evalangular.js:12799 Scope.$applyangular.js:1447 (anonymous function)angular.js:3966 invokeangular.js:1445 doBootstrapangular.js:1459 bootstrapangular.js:1368 angularInitangular.js:22019 (anonymous function)jquery.min.js:2 jjquery.min.js:2 k.fireWithjquery.min.js:2 m.extend.readyjquery.min.js:2 J

@RyanMullins
Copy link
Owner

Awesome, thanks for dropping that in there.

@mattmcdonald-uk
Copy link
Author

Thanks for looking into this bug :)

@RyanMullins
Copy link
Owner

Hmm... That version of Hammer is old. I've updated it to v2.0.4. Some locations moved too, so use these links:

http://ryanmullins.github.io/angular-hammer/examples/raw/hammer.js
http://ryanmullins.github.io/angular-hammer/examples/raw/angular.js

Take a look at it now and see what happens. I think you might still get a similar error, but I just want to be sure we're on the latest and greatest.

@mattmcdonald-uk
Copy link
Author

No change using those versions.

@blakgeek
Copy link

I fixed this by adding another additional directive named hm-require-failure that runs after all the recognizers are created. The problem is that hammer needs both of the recognizers to exist when enabling require failure. The current implementation tries to apply the recognizers options as it processes each recognizer directive.

You can see the details here in the PR #57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants