MCPcopy Create free account
hub / github.com/Shitanshukumar607/Drawspace / handlePointerMove

Function handlePointerMove

hooks/DrawEllipseTool.ts:57–74  ·  view source on GitHub ↗
(e: KonvaEventObject<MouseEvent | TouchEvent>)

Source from the content-addressed store, hash-verified

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;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected