Giter Club home page Giter Club logo

Comments (10)

any86 avatar any86 commented on August 26, 2024
new AnyTouch(el, { preventDefault: false });

不阻止默认不行吗? 是同时还有使用了pan? 请描述下功能需求 或者 发段代码

from any-touch.

kailong321200875 avatar kailong321200875 commented on August 26, 2024
new AnyTouch(el, { preventDefault: false });

不阻止默认不行吗? 是同时还有使用了pan? 请描述下功能需求 或者 发段代码

现在只使用了pinch,捏合的,比如捏合到超过屏幕可是区域,向下滑的话,页面应该是要滚动到下面的,但是用了之后,不管是怎么滑动,都没办法,如果取消组件默认事件,捏合的时候,流畅度没有那么高,会卡顿。

from any-touch.

any86 avatar any86 commented on August 26, 2024

你的预期是2指触发pinch同时阻止默认事件, 1指正常拖动原生滚动?

from any-touch.

kailong321200875 avatar kailong321200875 commented on August 26, 2024

你的预期是2指触发pinch同时阻止默认事件, 1指正常拖动原生滚动?

是的

from any-touch.

any86 avatar any86 commented on August 26, 2024

我看过的应用都是上了手势 , 就会阻止默认滚动事件的, 这种交互也没什么问题啊. 一般都会给绑定元素的2侧留一部分空间不不绑定事件,用来拖拽原生滚动

原因

如果阻止默认, 就需要在toustart阶段就阻止, 一旦阻止了, 除非手指都离开, 否则阻止默认一直存在.

后续

我稍后可以能会试下做个选项, 来决定让第n值的touchstart触发阻止默认,这个需要时间测试, 暂时发不了, 你可以考虑最一段文字的交互

from any-touch.

kailong321200875 avatar kailong321200875 commented on August 26, 2024

我看过的应用都是上了手势 , 就会阻止默认滚动事件的, 这种交互也没什么问题啊. 一般都会给绑定元素的2侧留一部分空间不不绑定事件,用来拖拽原生滚动

原因

如果阻止默认, 就需要在toustart阶段就阻止, 一旦阻止了, 除非手指都离开, 否则阻止默认一直存在.

后续

我稍后可以能会试下做个选项, 来决定让第n值的touchstart触发阻止默认,这个需要时间测试, 暂时发不了, 你可以考虑最一段文字的交互

行,那我这边先看看改个交互

from any-touch.

any86 avatar any86 commented on August 26, 2024

突然想起, 你可以通过这个api试试, 我上面说的逻辑. 我下班以后试下可行就会发到文档中
https://github.com/any86/any-touch/blob/master/docs/API.md

image

from any-touch.

kailong321200875 avatar kailong321200875 commented on August 26, 2024

突然想起, 你可以通过这个api试试, 我上面说的逻辑. 我下班以后试下可行就会发到文档中 https://github.com/any86/any-touch/blob/master/docs/API.md

image

我试试这个api

from any-touch.

any86 avatar any86 commented on August 26, 2024

我试了下, 可以这么写:

        const at = new AnyTouch(this.$refs.panel, {
            preventDefault: true,
            preventDefaultExclude(e) {
                return 1 == e.touches.length;
            },
        });

只有>1指的时候才触发"阻止默认"

from any-touch.

kailong321200875 avatar kailong321200875 commented on August 26, 2024

我试了下, 可以这么写:

        const at = new AnyTouch(this.$refs.panel, {
            preventDefault: true,
            preventDefaultExclude(e) {
                return 1 == e.touches.length;
            },
        });

只有>1指的时候才触发"阻止默认"

好的。

from any-touch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.