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

Function handleLineDragEnd

components/CanvasComponent.tsx:253–270  ·  view source on GitHub ↗
(id: string, e: KonvaEventObject<Event>)

Source from the content-addressed store, hash-verified

251 };
252
253 const handleLineDragEnd = (id: string, e: KonvaEventObject<Event>) => {
254 const node = e.target as Konva.Line;
255 const deltaX = node.x();
256 const deltaY = node.y();
257
258 if (deltaX === 0 && deltaY === 0) return;
259
260 const line = drawingLines.lines.find((line) => line.id === id);
261 if (!line) return;
262
263 node.position({ x: 0, y: 0 });
264 drawingLines.updateLine(id, {
265 initialX: line.initialX + deltaX,
266 initialY: line.initialY + deltaY,
267 x: line.x + deltaX,
268 y: line.y + deltaY,
269 });
270 };
271
272 const handleEllipseDragEnd = (id: string, e: KonvaEventObject<Event>) => {
273 const node = e.target as Konva.Ellipse;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected