Commit 6c60202d9a824701b3c9167cf59ecb02b764f67c
1 parent
f642f0b6
beginPath
Showing
1 changed file
with
12 additions
and
9 deletions
packageB/miniprogram_npm/mini-luck-draw/lucky-wheel/index.js
... | ... | @@ -314,15 +314,18 @@ Component({ |
314 | 314 | this.toPlay(x, y); |
315 | 315 | }, |
316 | 316 | toPlay: function toPlay(x, y) { |
317 | - var ctx = this.ctx; | |
318 | - ctx.beginPath(); | |
319 | - ctx.arc(0, 0, this.$lucky.maxBtnRadius, 0, Math.PI * 2, false); | |
320 | - if (!ctx.isPointInPath(x * this.dpr, y * this.dpr)) return; | |
321 | - // 隐藏图片并显示canvas | |
322 | - this.showCanvas = true; | |
323 | - this.setData({ luckyImg: '' }); | |
324 | - // 触发 lucky-canvas 的抽奖逻辑 | |
325 | - this.$lucky.startCallback(); | |
317 | + var th=this; | |
318 | + setTimeout(function () { | |
319 | + var ctx = th.ctx; | |
320 | + ctx.beginPath(); | |
321 | + ctx.arc(0, 0, th.$lucky.maxBtnRadius, 0, Math.PI * 2, false); | |
322 | + if (!ctx.isPointInPath(x * th.dpr, y * th.dpr)) return; | |
323 | + // 隐藏图片并显示canvas | |
324 | + th.showCanvas = true; | |
325 | + th.setData({ luckyImg: '' }); | |
326 | + // 触发 lucky-canvas 的抽奖逻辑 | |
327 | + th.$lucky.startCallback(); | |
328 | + },400) | |
326 | 329 | }, |
327 | 330 | play: function play() { |
328 | 331 | var _$lucky; | ... | ... |