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

Docs don't explain how to listen to pan end when using custom Pan instance #51

Open
hackhat opened this issue Aug 23, 2018 · 2 comments

Comments

@hackhat
Copy link

hackhat commented Aug 23, 2018

  const zingPan = new ZingTouch.Pan({
    numInputs: 1,
    threshold: 1,
  });
  zingTouchActiveRegion.bind(this.canvasElement, zingPan, (e) => {
  });

What should I do to get the pan end event?

@mvanderkamp
Copy link
Contributor

IIRC, something like this should work:

const zingPan = new ZingTouch.Pan({
  numInputs: 1,
  threshold: 1,
});
const panEnd = zingPan.end; // save the default pan end function.
zingPan.end = function customEnd(inputs, state, element) {
  // ... stuff you want done before the default end.
  panEnd(inputs, state, element);
  // ... stuff you want done after the default end.
};
ZingTouchActiveRegion.bind(this.canvasElement, zingPan, (e) => {
});

It's a little less than elegant, but it works well and makes things easy to customize, although you do have to poke around in the source code.

@hackhat
Copy link
Author

hackhat commented Aug 24, 2018

Yeah, the api looks pretty bad. I wonder if is buggy on mobile. I'm coming from hammerjs and sometimes it misses some pan/pinch events and is pretty annoying. Happens the same with this library? or any known annoying bugs?

@hackhat hackhat closed this as completed Aug 24, 2018
@hackhat hackhat reopened this Aug 24, 2018
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