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

Function handlePointerDown

hooks/DrawArrowTool.ts:25–49  ·  view source on GitHub ↗
(e: KonvaEventObject<MouseEvent | TouchEvent>)

Source from the content-addressed store, hash-verified

23 const currentArrowId = useRef<string | null>(null);
24
25 const handlePointerDown = (e: KonvaEventObject<MouseEvent | TouchEvent>) => {
26 if (tool !== "arrow") return;
27
28 // Save current state before starting new drawing
29 saveToHistory();
30
31 isDrawing.current = true;
32
33 const stage = e.target.getStage();
34 const pos = stage ? getPointerPositionRelativeToStage(stage) : null;
35 if (!pos) return;
36
37 const id = createShapeId();
38 currentArrowId.current = id;
39
40 addArrow({
41 id,
42 x: pos.x,
43 y: pos.y,
44 points: [0, 0, 0, 0],
45 stroke: properties.stroke,
46 strokeWidth: properties.strokeWidth,
47 opacity: properties.opacity,
48 });
49 };
50
51 const handlePointerMove = (e: KonvaEventObject<MouseEvent | TouchEvent>) => {
52 if (!isDrawing.current || tool !== "arrow") return;

Callers

nothing calls this directly

Calls 2

createShapeIdFunction · 0.90

Tested by

no test coverage detected