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

@any-touch/pan 怎么动态设置 pointLength 呢 #108

Closed
hellohejinyu opened this issue Jul 21, 2022 · 2 comments
Closed

@any-touch/pan 怎么动态设置 pointLength 呢 #108

hellohejinyu opened this issue Jul 21, 2022 · 2 comments

Comments

@hellohejinyu
Copy link

使用场景是画笔在画布上画画,画笔未激活时用户可以用单指移动画布,但是画笔激活时,单指移动就是画画了。此时双指移动才是移动画布。

@any86
Copy link
Owner

any86 commented Jul 21, 2022

定义一个双指拖拽识别器:

// 只加载pan识别器(拖拽)
import ATouch from 'any-touch';
import pan from '@any-touch/pan';

const at = new ATouch (el);
at.use(pan, {pointLength :2, name:'pan2'})

// 单指拖拽
at.on('pan', (event) => {
   
});

// 双指拖拽 
at.on('pan2', (event) => {
    
});

@hellohejinyu
Copy link
Author

定义一个双指拖拽识别器:

// 只加载pan识别器(拖拽)
import ATouch from 'any-touch';
import pan from '@any-touch/pan';

const at = new ATouch (el);
at.use(pan, {pointLength :2, name:'pan2'})

// 单指拖拽
at.on('pan', (event) => {
   
});

// 双指拖拽 
at.on('pan2', (event) => {
    
});

赞,原来 name 字段是用来干这个的。我以为一种手势只能被 use 一次。

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