* Draws a progress bar on the node. * @param ctx The canvas context to draw on
(ctx: CanvasRenderingContext2D)
| 3839 | * @param ctx The canvas context to draw on |
| 3840 | */ |
| 3841 | drawProgressBar(ctx: CanvasRenderingContext2D): void { |
| 3842 | if (!this.progress) return |
| 3843 | |
| 3844 | const originalFillStyle = ctx.fillStyle |
| 3845 | ctx.fillStyle = "green" |
| 3846 | ctx.fillRect( |
| 3847 | 0, |
| 3848 | 0, |
| 3849 | this.width * this.progress, |
| 3850 | 6, |
| 3851 | ) |
| 3852 | ctx.fillStyle = originalFillStyle |
| 3853 | } |
| 3854 | } |