小游戏开发

发布于 7 年前作者 mengping11096 次浏览最后编辑 7 年前来自 ask

坐的小游戏项目,有不同页面,在一个位置都有按钮,一个页面结束后进入另一个,但是点击那个位置还是触发上页面的点击事件,清楚canvas用clrearRect不好用?

1 回复
qiufang
qiufang1 楼5 年前

要移除点击事件

this.startTouchEventBind = this.startTouchEventHandle.bind(this)
this.moveTouchEventBind = this.moveTouchEventHandle.bind(this)
this.endTouchEventBind = this.endTouchEventHandle.bind(this)
canvas.removeEventListener('touchstart', this.startTouchEventBind)
canvas.removeEventListener('touchmove', this.moveTouchEventBind)
canvas.removeEventListener('touchend', this.endTouchEventBind)