vue-pull-refresh icon indicating copy to clipboard operation
vue-pull-refresh copied to clipboard

Cancelling? Using with Hammer.js

Open grumpygary opened this issue 7 years ago • 3 comments

Using vue-pull-refresh (VPR) with hammer.js works well, but...

When panning left/right on a page with a VPR component, it would be nice to be able to tell VPR to cancel (resetPullDown) and have VPR stop processing events, but this is private to the mounted/$nextTick handler.

Exposing resetPullDown (I know it's not that simple) would allow both panning and VPR functionality to co-exist. Currently both work, but from a user perspective, once panning begins the VPR functionality should cease.

grumpygary avatar Nov 29 '17 23:11 grumpygary

I've implemented a patch that seems to work for me.

1 - At the beginning of "touchmove": if (this.cancelPull) { this.pullDown.height = 0; } else

2 - At beginning of "touchstart": this.cancelPull = false;

3 - Then, from the wrapped component, find VPR ($children[0]) and simply set vpr.cancelPull = true; -- the pull will be cancelled and the puller reset. From what I can tell, I don't think it matters how and when cancelPull gets set.

Works like a charm!

grumpygary avatar Nov 30 '17 13:11 grumpygary

@garyskiba Maybe you can make a pull request ?

lakb248 avatar Dec 01 '17 02:12 lakb248

OK. Now I have to create a project, etc. :-) That's ok. I like your component and will try to get this done in the next few days. BTW, a return is required, not else (I had done it differently than I showed).

-Gary

On Thu, Nov 30, 2017 at 8:07 PM, LinBin [email protected] wrote:

@garyskiba https://github.com/garyskiba Maybe you can make a pull request ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/lakb248/vue-pull-refresh/issues/14#issuecomment-348380781, or mute the thread https://github.com/notifications/unsubscribe-auth/ABWGM7JywlLZhlmPakNo8AbJDgZGaAK9ks5s719kgaJpZM4QvxxX .

grumpygary avatar Dec 01 '17 15:12 grumpygary