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

Function handlePointerDown

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

Source from the content-addressed store, hash-verified

27 } | null>(null);
28
29 const handlePointerDown = (e: KonvaEventObject<MouseEvent | TouchEvent>) => {
30 if (tool !== "ellipse") return;
31
32 // Save current state before starting new drawing
33 saveToHistory();
34
35 isDrawing.current = true;
36
37 const stage = e.target.getStage();
38 const pos = stage ? getPointerPositionRelativeToStage(stage) : null;
39 if (!pos) return;
40
41 const id = createShapeId();
42 currentDraw.current = { id, startX: pos.x, startY: pos.y };
43
44 addEllipse({
45 id,
46 x: pos.x,
47 y: pos.y,
48 radiusX: 0,
49 radiusY: 0,
50 stroke: properties.stroke,
51 fill: properties.fill,
52 strokeWidth: properties.strokeWidth,
53 opacity: properties.opacity,
54 });
55 };
56
57 const handlePointerMove = (e: KonvaEventObject<MouseEvent | TouchEvent>) => {
58 if (!isDrawing.current || tool !== "ellipse") return;

Callers

nothing calls this directly

Calls 2

createShapeIdFunction · 0.90

Tested by

no test coverage detected