(e: KonvaEventObject<MouseEvent | TouchEvent>)
| 55 | }; |
| 56 | |
| 57 | const handlePointerMove = (e: KonvaEventObject<MouseEvent | TouchEvent>) => { |
| 58 | if (!isDrawing.current || tool !== "ellipse") return; |
| 59 | |
| 60 | const stage = e.target.getStage(); |
| 61 | const pos = stage ? getPointerPositionRelativeToStage(stage) : null; |
| 62 | if (!pos) return; |
| 63 | |
| 64 | const current = currentDraw.current; |
| 65 | if (!current) return; |
| 66 | |
| 67 | const { startX, startY, id } = current; |
| 68 | const radiusX = Math.max(Math.abs(pos.x - startX) / 2, 1); |
| 69 | const radiusY = Math.max(Math.abs(pos.y - startY) / 2, 1); |
| 70 | const x = (startX + pos.x) / 2; |
| 71 | const y = (startY + pos.y) / 2; |
| 72 | |
| 73 | updateEllipseInStore(id, { x, y, radiusX, radiusY }); |
| 74 | }; |
| 75 | |
| 76 | const handlePointerUp = () => { |
| 77 | isDrawing.current = false; |
nothing calls this directly
no test coverage detected