Comments (10)
new AnyTouch(el, { preventDefault: false });
不阻止默认不行吗? 是同时还有使用了pan? 请描述下功能需求 或者 发段代码
from any-touch.
new AnyTouch(el, { preventDefault: false });不阻止默认不行吗? 是同时还有使用了pan? 请描述下功能需求 或者 发段代码
现在只使用了pinch,捏合的,比如捏合到超过屏幕可是区域,向下滑的话,页面应该是要滚动到下面的,但是用了之后,不管是怎么滑动,都没办法,如果取消组件默认事件,捏合的时候,流畅度没有那么高,会卡顿。
from any-touch.
你的预期是2指触发pinch同时阻止默认事件, 1指正常拖动原生滚动?
from any-touch.
你的预期是2指触发pinch同时阻止默认事件, 1指正常拖动原生滚动?
是的
from any-touch.
我看过的应用都是上了手势 , 就会阻止默认滚动事件的, 这种交互也没什么问题啊. 一般都会给绑定元素的2侧留一部分空间不不绑定事件,用来拖拽原生滚动
原因
如果阻止默认, 就需要在toustart阶段就阻止, 一旦阻止了, 除非手指都离开, 否则阻止默认一直存在.
后续
我稍后可以能会试下做个选项, 来决定让第n值的touchstart触发阻止默认,这个需要时间测试, 暂时发不了, 你可以考虑最一段文字的交互
from any-touch.
我看过的应用都是上了手势 , 就会阻止默认滚动事件的, 这种交互也没什么问题啊. 一般都会给绑定元素的2侧留一部分空间不不绑定事件,用来拖拽原生滚动
原因
如果阻止默认, 就需要在toustart阶段就阻止, 一旦阻止了, 除非手指都离开, 否则阻止默认一直存在.
后续
我稍后可以能会试下做个选项, 来决定让第n值的touchstart触发阻止默认,这个需要时间测试, 暂时发不了, 你可以考虑最一段文字的交互
行,那我这边先看看改个交互
from any-touch.
突然想起, 你可以通过这个api试试, 我上面说的逻辑. 我下班以后试下可行就会发到文档中
https://github.com/any86/any-touch/blob/master/docs/API.md
from any-touch.
突然想起, 你可以通过这个api试试, 我上面说的逻辑. 我下班以后试下可行就会发到文档中 https://github.com/any86/any-touch/blob/master/docs/API.md
我试试这个api
from any-touch.
我试了下, 可以这么写:
const at = new AnyTouch(this.$refs.panel, {
preventDefault: true,
preventDefaultExclude(e) {
return 1 == e.touches.length;
},
});
只有>1指的时候才触发"阻止默认"
from any-touch.
我试了下, 可以这么写:
const at = new AnyTouch(this.$refs.panel, { preventDefault: true, preventDefaultExclude(e) { return 1 == e.touches.length; }, });只有>1指的时候才触发"阻止默认"
好的。
from any-touch.
Related Issues (20)
- 移动端无法滚动 HOT 15
- 【BUG】Vue3 中指令方式设置参数没效果 HOT 2
- 【BUG】Vue3 press 按压事件不触发 HOT 6
- 原生js如何使用
- swipe 很难触发 HOT 1
- vue3指令版的doubletap无效 HOT 1
- @any-touch/pan 怎么动态设置 pointLength 呢 HOT 2
- 父元素监听 panmove, pinch 事件,子元素中 mousedown 不再触发 HOT 2
- 希望能支持在捕获阶段处理事件 HOT 1
- 如何在uniapp 中使用? HOT 2
- canvas 下 绘制的文字如何使用? HOT 1
- 有关 changelog HOT 1
- press 事件是否有按压中以及结束的回调。 HOT 2
- souce map 警告处理下呗
- 不传入el,用catchEvent传入事件的方式,points无法初始化
- 【BUG】报错Sourcemap
- 基于any-touch手势库封装的Vue(2 & 3)的指令 HOT 3
- 可以在canvas上使用吗? HOT 4
- 慢速拖动时 panend 有很大几率不触发 HOT 16
- [doc] Add the library compatibility information? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from any-touch.