angular-scrolly icon indicating copy to clipboard operation
angular-scrolly copied to clipboard

ngClick is invoked when scrolling

Open bugwelle opened this issue 11 years ago • 2 comments

Hello, I'm using angular-scrolly in a PhoneGap app and it's working quite well :+1: Only one problem. Sometimes when scrolling it happens that the ngClick directive of ngTouch is invoked.

I fixed this for me by inserting

if (self.state.distance.y > 20 || self.state.distance.y < -20) {
    e.preventDefault();
}

before https://github.com/ajoslin/angular-scrolly/blob/master/src/services/dragger.js#L280 (line 280)

I'm checking whether the users scrolls more than 20 pixels. I know there has to be a better solution but I'm not very familiar with the angular-scrolly code... :)

Regards, Andre

bugwelle avatar Jan 11 '14 18:01 bugwelle

hmm. This fix would stop things like click-n-drag unfortunately.

Could you create a reproduce case on plnkr.co?

ajoslin avatar Jan 22 '14 16:01 ajoslin

http://run.plnkr.co/ONe8rbUiOvcSeZlq/ Well, it seems to work well on that test page... :/ I'll have a look on that tomorrow. These are my directives/services/... I'm using:

'ngTouch' 'ngRoute' 'jm.i18next' 'ajoslin.scrolly' 'ajoslin.mobile-navigate' 'snap'

Even if this would stop things like click-n-drag, it helps me. And I don't have any click-n-drag thing in my app :D

Regards, Andre

bugwelle avatar Jan 22 '14 19:01 bugwelle