From 032fabc76b25341a0ff83a17edc4933d875c3271 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 23 Jul 2024 08:40:44 +0530 Subject: [PATCH] feat: emit mousedown event on click confirmation --- src/components/atoms/canvas.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/atoms/canvas.tsx b/src/components/atoms/canvas.tsx index 1e7f0fb6..9ddcc628 100644 --- a/src/components/atoms/canvas.tsx +++ b/src/components/atoms/canvas.tsx @@ -47,9 +47,10 @@ const Canvas = ({ width, height, onCreateRef, isClickConfirmed, resetClickConfir switch (event.type) { case 'mousedown': const clickCoordinates = getMappedCoordinates(event, canvasRef.current, width, height); - //socket.emit('input:mousedown', clickCoordinates); - console.log('you clicked on:', clickCoordinates); - notifyLastAction('click'); + if (isClickConfirmed) { + socket.emit('input:mousedown', clickCoordinates); + notifyLastAction('click'); + } break; case 'mousemove': const coordinates = getMappedCoordinates(event, canvasRef.current, width, height);