提交 98023983 编写于 作者: H hdx

chord(canvas): 避免使用 bind this

上级 28442497
......@@ -61,10 +61,7 @@
constructor(ctx : CanvasRenderingContext2D) {
this.ctx = ctx
this.initBall()
this.ctx.fillStyle = '#007AFF'
// #ifdef WEB
this._bindAnimate = this.animate.bind(this)
// #endif
this.ctx.fillStyle = '#007AFF'
}
private getDistance(x : number, y : number) : number {
......@@ -106,7 +103,9 @@
if (!this.runningFlag) {
return
}
this._animateResult = requestAnimationFrame(this.animate.bind(this))
this._animateResult = requestAnimationFrame(() => {
this.animate()
})
// #endif
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册