【发布时间】:2014-08-20 13:50:51
【问题描述】:
我正在使用 ImpactJS 引擎 (http://impactjs.com/) 构建游戏。游戏需要拖动和滑动等手势。因此,HammerJS 集成在代码中。
在下面的sn-p中,左键绑定为ig.input时,不会触发释放事件回调。
init : function() {
// The onRelease() is triggered when this is commented out.
//ig.input.bind( ig.KEY.MOUSE1, "click" );
Hammer( this.canvas ).on( "dragup", this.onDragUp.bind( this ) );
Hammer( this.canvas ).on( "dragdown", this.onDragDown.bind( this ) );
Hammer( this.canvas ).on( "release", this.onRelease.bind( this ) );
},
onRelease : function() {
alert( "Released!" );
}
onDragUp : function( event ) {
//No problem here.
}
onDragDown : function( event ) {
//No problem here.
}
这里似乎有什么问题?谢谢。
【问题讨论】:
标签: javascript html hammer.js impactjs