(e: KonvaEventObject<MouseEvent | TouchEvent>)
| 60 | }; |
| 61 | |
| 62 | const handlePointerMove = (e: KonvaEventObject<MouseEvent | TouchEvent>) => { |
| 63 | if (!isDrawing.current || tool !== "rectangle") return; |
| 64 | |
| 65 | const stage = e.target.getStage(); |
| 66 | const pos = stage ? getPointerPositionRelativeToStage(stage) : null; |
| 67 | if (!pos) return; |
| 68 | |
| 69 | const current = currentDraw.current; |
| 70 | if (!current) return; |
| 71 | |
| 72 | const { startX, startY, id } = current; |
| 73 | const x = Math.min(startX, pos.x); |
| 74 | const y = Math.min(startY, pos.y); |
| 75 | const width = Math.max(Math.abs(pos.x - startX), 1); |
| 76 | const height = Math.max(Math.abs(pos.y - startY), 1); |
| 77 | |
| 78 | updateRectangleInStore(id, { x, y, width, height }); |
| 79 | }; |
| 80 | |
| 81 | const handlePointerUp = () => { |
| 82 | isDrawing.current = false; |
nothing calls this directly
no test coverage detected