josdejong / propagating-hammerjs

Extend hammer.js with event propagation
MIT License
40 stars 14 forks source link

panmove is not work when swipe first time in device of android #10

Open Krishna25Vrinsoft opened 7 years ago

Krishna25Vrinsoft commented 7 years ago

I am facing issue with "panmove". when i swipe bottom to top and top to bottom its not work first time. I have used Hammerjs with backbonejs hybrid mobile app. I have make a bottom penal when it swipe we do some more option. but its not work properly. when i swipe second time it work fine. at first time i am not getting panmove event same thing i am getting in ios device.

this.$el.html("#div")
this.$el.hammer();
this.$el.data('hammer').get('pan').set({ threshold: 5 });
this.initHeight = -(this.$el.outerHeight() - this.$('.swiper-container').outerHeight());
this.estimateTopPosition = this.$el.position().top;

//This function call on panup, pandown, panstart, panmove, panend, pancancel, panright, panleft, tap, press event
fareContainerSwipe: function (e) {
    var swipeType = e.type;
    var speed = 500;
    console.log(e.type + ', ' + e.gesture.offsetDirection + ', ' + e.gesture.direction + ', ' + e.gesture.distance + ', deltaY: ' + e.gesture.deltaY);
    var distance = e.gesture.distance;
    var nav = this.$el;
    var transInitHeight = this.transInitHeight;
    var currentPosition = this.$el.position();

    var mDistance;

    if (swipeType == 'panmove' && (e.gesture.direction == 16)) { //Pan down

    }else if (swipeType == 'panmove' && e.gesture.direction == 8) {    //Pan up

    }
} 
josdejong commented 7 years ago

Can you create a jsbin or jsfiddle to demonstrate the issue? It's hard to guess what's going on exactly from the code snippet that you posted.