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

Non global config #52

Closed
nolimitdev opened this issue Feb 12, 2020 · 9 comments
Closed

Non global config #52

nolimitdev opened this issue Feb 12, 2020 · 9 comments

Comments

@nolimitdev
Copy link
Contributor

Hi, is it possible to override global config? E.g. I would like to use sometimes short distance swipe with default tapTolerance = 10 but sometimes I need to use long distance swipe e.g. tapTolerance = 300. It seems that there is only one option item that support inline configuration per element... touchClass => v-touch-class. I have tested similarly v-tap-tolerance or v-touch-tap-tolerance but it does not work.

@jerrybendy
Copy link
Owner

Hi, global configuration overriding is not supported yet.

@nolimitdev
Copy link
Contributor Author

See PR #53 What about you? Is it possible to merge please?

@jerrybendy
Copy link
Owner

Hi, the constructor of VueTouchEvents has many options, not only swipeTolerance. So I think add a directive for Tolerance only is not a good idea.

I think, it would be better to add an option parameter to the handlers to override default options. Like below:

<span
     v-touch:tap="{handler: tapHandler, options: {swipeTolerance: 10, tapTolerance: 10}}"
>Tap</span>

@nolimitdev
Copy link
Contributor Author

Ok, I will use so far my forked version in my project. I'm looking forward to use options in future as you suggested.

jerrybendy added a commit that referenced this issue Feb 14, 2020
@jerrybendy
Copy link
Owner

v2.2.0 has been released. The usage changes to using v-touch-options to customize configuration for specified component.

<span v-touch-options="{swipeTolerance: 10}">something</span>

nolimitdev added a commit to nolimitdev/vue-touch-events that referenced this issue Feb 15, 2020
@nolimitdev
Copy link
Contributor Author

nolimitdev commented Feb 15, 2020

Thank you very much for great new feature. There is a little bug in v2.2.0. See PR #54
When I have two or more v-touch:swipe.* directives I get error TypeError: "$el.$$touchObj is undefined" unbind index.js:317 on leaving/destroying component.

@jerrybendy
Copy link
Owner

Thanks for your PR. I have merged it and release a new version v2.2.1. 😄

@breslauer
Copy link

breslauer commented Jun 19, 2020

(Sorry for my english) I think the implementation is not good. For me the idea I think, it would be better to add an option parameter to the handlers to override default options. was better. Right now if you want to change disableClick option (in my project disableClick is true in global options) it could not work, cause you overwrite options later than add event listener for our element. In developer version you can define v-touch-options first and it will work, but in production mode it could be tricky.

works:
v-touch-options="{ disableClick: false }" v-touch:swipe.left="handleSwipe"

doesn't work:
v-touch:swipe.left="handleSwipe" v-touch-options="{ disableClick: false }"

@jerrybendy
Copy link
Owner

Hi @breslauer ,

My English is not good either. The problem you said is really an issue. The v-touch directive doesn't know the overwirted value of disableClick when binding events. This causes this issue. Do you have any advice to solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants