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

Pan event is not working properly when user move up and down #1

Open
Davids0da opened this issue Jan 25, 2018 · 1 comment
Open

Pan event is not working properly when user move up and down #1

Davids0da opened this issue Jan 25, 2018 · 1 comment

Comments

@Davids0da
Copy link

Hi,

I am trying to use your HummerJS in Angular 4.3.6. The problem that i have is with pan gesture. He perfectly works when you moving element left and right, but when you try to do the same with up and down, it has delay. I tested it on Iphone 5s ( IOS 10 ), and in mobile view in Chrome ( Nexus 5x).
I saw after that you have same problem on your web tutorial. ( https://saschwarz.github.io/angular2-gestures-slides/#/8 ).

Thanks for the answer!
Best regards,
David

@saschwarz
Copy link
Owner

saschwarz commented Jan 25, 2018

I don't have time to look at it now, but it is likely because I don't have the pan direction set to all. Here's some code I use in one of my Ionic apps to set up the default Hammer pan to work in all directions:

import { HAMMER_GESTURE_CONFIG, HammerGestureConfig } from '@angular/platform-browser';
import {
    DIRECTION_HORIZONTAL,
    DIRECTION_LEFT,
    DIRECTION_RIGHT,
    DIRECTION_VERTICAL
} from 'ionic-angular/gestures/hammer'; 
// You won't have this import in plain Angular, it might be somewhere though. Otherwise look in the hammer source for these and replace with the binary or of their values I seem to recall it might be 31????


export class HammerConfig extends HammerGestureConfig {
    // by default only vertical pan is enabled
    overrides = {
        pan: {
            enable: true,
            threshold: 1,
            direction: DIRECTION_HORIZONTAL | DIRECTION_LEFT | DIRECTION_RIGHT | DIRECTION_VERTICAL
        }
    }
}

// in your providers:

    {
        provide: HAMMER_GESTURE_CONFIG,
        useClass: HammerConfig
    }

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

No branches or pull requests

2 participants