Git Product home page Git Product logo

touchjs's Introduction

Touchjs Getsture Library

API

API Docs

EXAMPLES

Examples

NOTE

与0.2.6及之前的touch.js兼容问题

兼容原因

0.2.6及之前的touch.js不支持事件代理机制,而新的touch.js通过手势识别,事件冒泡及原生的事件对象,提供事件代理机制和自定义事件的能力,从而极大提升性能。原有的stopPropagation会阻止原生事件冒泡,从而使手势识别失效,因此,需要手动删除/注释stopPropagation语句。麻烦各位根据自己项目的实际情况,选择性升级touch.js。

兼容方法

删除/注释所有绑定中的stopPropagation方法

touch.on('#rotation .target', 'touchstart', function(ev){ ev.startRotate();
	ev.originEvent.preventDefault(); 
	//ev.originEvent.stopPropagation(); 	//注释掉或者删掉stopPropagation方法
});

包管理器

Touchjs已发布至多种包管理器,可以通过以下包管理器来管理Touchjs:

  • NPM

    安装: npm install touchjs

    更新: npm update touchjs

    卸载: npm uninstall touchjs

  • spm

    安装: spm install touchjs

  • Bower

    安装: bower install touchjs

    更新: bower update touchjs

    卸载: bower uninstall touchjs

  • Component

    安装: conponent install brandnewera/touchjs

问题反馈

如有疑问, 可以直接提issue, 我们会及时为您解答. 欢迎就touch.js提出宝贵的批评和建议.

touchjs's People

Contributors

afc163 avatar firede avatar huang-xin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

touchjs's Issues

阅读源码发现off方法有个缺陷

不知道这个开源还有没有在维护,发现了个缺陷,还是提一下吧。

  • Operating System:mac
  • Browser:chrome
  • Touchjs version: 0.2.14

Expected Behavior

off事件时,可以正常能正常移除

Actual Behavior

off事件时,提示this.proxies 不存在。

To fix

通过浏览器调试。发现是this指向错误的原因。
我的修复方法是,在forEach外线指定_this = this;

一下是源代码(src/event.js):

var proxyids = handler.proxy[evt];
            if (proxyids && proxyids.length) {
                proxyids.forEach(function(proxyid) {
                    if (el.removeEventListener) {
                       // 非严格模式下,forEach 匿名函数this指向window
                        el.removeEventListener(evt, this.proxies[this.proxyid], false);
                    }
                });
            }

jquery2.1.1兼容问题

用了
'''
touch.on('#body', 'tap hold', '.eye', function(ev) {
$(ev.target).removeClass('eye').addClass('eye1') //这里失效了
})
'''

关于版本 release 的方式

问题

dist 内放置各个版本 release 后的 js,不利于与各种前端 包管理器 结合。

dist

因为 src 目录中的代码合并前不能被直接使用,建议 dist 目录下放当前版本 build 后的 js,不带版本号(脚本搞定):

dist/
└── touch.js

分版本下载可以通过给 git 打 tag 来解决,像这样

PS: 既然木有版本好了,build 后的文件直接丢根目录也行,dist 都省了~

release

每次 release 经过以下步骤:

  • 将源代码 build 至 dist/
  • 修改 package.jsonbower.jsoncomponent.json 的版本号
  • git 上打 tag
  • 发布至各个包管理器

包管理器

发布到各个包管理器,与用户各自的体系更契合,可以这样引入touchjs:

bower install touchjs
component install touchjs
edp import touchjs

各自使用的配置文件为:

  • bower: bower.json
  • component: component.json
  • edp: package.json

关于engine.bind 和 engine.unbind 的一点疑问

根据bind的代码可以看出,el实际上绑定的回调函数其实是将handler包装后的proxy。在unbind函数中,当handler不存在的情况下,默认是解绑el上evt类型的所有回调函数,代码里面解绑的回调函授是从el.listeners取出来的,可el. listeners中的函数都是未包装的handler函数,因此,我认为这种情况下unbind是没有效果的,求解~~

iOS7 safar simepleClone 方法出现异常

使用 pinch 方法。
浏览器 iOS7 safari

simpleClone 方法出现异常

TypeError: JSON.stringify cannot serialize cyclic structures

老老实实对象深拷贝吧~~~

在Github上开发便于社区协作?

有些地方想提pull request(比如无全局变量的AMD支持),但现在github放的只是release。
可以考虑直接在github上运作项目,便于社区协作与变更点的跟踪。

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.