RyanMullins / angular-hammer

Hammer.js v2 support for AngularJS
http://ryanmullins.github.io/angular-hammer/
MIT License
188 stars 55 forks source link

ghostclicks and iScroll #42

Closed kosich closed 9 years ago

kosich commented 9 years ago

For some reason, while using ng-hammerjs + ng-iscroll ghostClicks prevention some times fails: tap event handler triggers twice and even scrolls parent ng-iscroll element

some settings I'm using: ng-hammer preventGhost : true -- need it for touch laptops ng-iscroll preventDefault: false -- need it for forms to interact properly (see this issue)

so I've come up with a bit different ghost clicks elimination implementation, based on blocking touch events for some time after mouse events were triggered on the element and vice versa.

Please, see this gist

replace preventGhosts function in your angular.hammer.jswith code from the gist ( uncomment the console calls if needed to see whats happening )

Note: this has been tested only against chrome's "notebook with touch" emulation and HAS NOT been tested on a real device.

So, to sum up: if I'm not alone in running into such an issue and if this code works well on real touch devices I could create a PR.

Thanks.

kosich commented 9 years ago

ok, had to close it to make a quickfix. now it seem to work fine ( again, in emulation ). Please, provide some real device experience.

RyanMullins commented 9 years ago

Significant changes were merged with #55, please verify that this issue persists with those changes and update accordingly.

kosich commented 9 years ago

can't retest it atm, so since noone confirmed having the same issue, Ima close this one. Thx