(circle: Circle, update = false)
| 131 | const rgb = hexToRgb(color); |
| 132 | |
| 133 | const drawCircle = (circle: Circle, update = false) => { |
| 134 | if (context.current) { |
| 135 | const { x, y, translateX, translateY, size, alpha } = circle; |
| 136 | context.current.translate(translateX, translateY); |
| 137 | context.current.beginPath(); |
| 138 | context.current.arc(x, y, size, 0, 2 * Math.PI); |
| 139 | context.current.fillStyle = `rgba(${rgb.join(", ")}, ${alpha})`; |
| 140 | context.current.fill(); |
| 141 | context.current.setTransform(dpr, 0, 0, dpr, 0, 0); |
| 142 | |
| 143 | if (!update) { |
| 144 | circles.current.push(circle); |
| 145 | } |
| 146 | } |
| 147 | }; |
| 148 | |
| 149 | const clearContext = () => { |
| 150 | if (context.current) { |
no outgoing calls
no test coverage detected