()
| 65 | } |
| 66 | |
| 67 | render() { |
| 68 | const ctx = this.ctx; |
| 69 | const width = this.canvas.width / window.devicePixelRatio; |
| 70 | const height = this.canvas.height / window.devicePixelRatio; |
| 71 | |
| 72 | // 清空画布 |
| 73 | ctx.fillStyle = this.colors.background; |
| 74 | ctx.fillRect(0, 0, width, height); |
| 75 | |
| 76 | // 绘制网格背景 |
| 77 | this.drawGrid(width, height); |
| 78 | |
| 79 | // 绘制HUD边框 |
| 80 | this.drawHUD(width, height); |
| 81 | |
| 82 | // 根据模式绘制内容 |
| 83 | if (this.data.mode === 'SEGMENT') { |
| 84 | this.drawSegmentMode(width, height); |
| 85 | } else if (this.data.mode === 'FLASH') { |
| 86 | this.drawFlashMode(width, height); |
| 87 | } else if (this.data.mode === 'TRACK') { |
| 88 | this.drawTrackMode(width, height); |
| 89 | } |
| 90 | |
| 91 | // 绘制手部骨骼 |
| 92 | if (this.data.hand) { |
| 93 | this.drawHand(this.data.hand, width, height); |
| 94 | } |
| 95 | |
| 96 | // 绘制FPS和状态信息 |
| 97 | this.drawStats(width, height); |
| 98 | } |
| 99 | |
| 100 | drawGrid(width, height) { |
| 101 | const ctx = this.ctx; |
no test coverage detected