diff --git a/index.html b/index.html index ccdbf6a..9cfc01a 100644 --- a/index.html +++ b/index.html @@ -109,12 +109,16 @@ if (!this._canvas) return; - let radius = Math.min(this.options.iconSize[0], this.options.iconSize[1]); let ctx = this._canvas.getContext('2d'); - ctx.beginPath(); - ctx.arc(this.options.iconSize[0], this.options.iconSize[1], radius, 0, 2 * Math.PI); - ctx.fillStyle = state ? '#ff0' : '#000'; - ctx.fill(); + ctx.clearRect(0, 0, this.options.iconSize[0] * 2, this.options.iconSize[1] * 2); + + if (state) { + let radius = Math.min(this.options.iconSize[0], this.options.iconSize[1]); + ctx.beginPath(); + ctx.arc(this.options.iconSize[0], this.options.iconSize[1], radius, 0, 2 * Math.PI); + ctx.fillStyle = '#ff0'; + ctx.fill(); + } this._state = state; }