From 152c5501b35677a6ac9846fe2384d71dcbd9d430 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Tue, 23 Jul 2024 20:09:30 +0530 Subject: [PATCH] feat: use notify last action --- src/components/atoms/canvas.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/atoms/canvas.tsx b/src/components/atoms/canvas.tsx index 520c6d0b..2663d10f 100644 --- a/src/components/atoms/canvas.tsx +++ b/src/components/atoms/canvas.tsx @@ -69,7 +69,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) => lastMousePosition.current.y !== coordinates.y) { lastMousePosition.current = coordinates; socket.emit('input:mousemove', coordinates); - setLastAction('move'); + notifyLastAction('move'); } break; case 'mousedown': @@ -85,11 +85,11 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) => setShowConfirmation(true); } else { socket.emit('input:mousedown', coordinates); - setLastAction('click'); + notifyLastAction('click'); } } else { socket.emit('input:mousedown', coordinates); - setLastAction('click'); + notifyLastAction('click'); } break; case 'wheel': @@ -99,7 +99,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) => deltaY: Math.round(wheelEvent.deltaY), }; socket.emit('input:wheel', deltas); - setLastAction('scroll'); + notifyLastAction('scroll'); break; } } @@ -110,7 +110,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) => switch (event.type) { case 'keydown': socket.emit('input:keydown', { key: event.key, coordinates: lastMousePosition.current }); - setLastAction(`${event.key} pressed`); + notifyLastAction(`${event.key} pressed`); break; case 'keyup': socket.emit('input:keyup', event.key); @@ -122,7 +122,7 @@ const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) => const handleConfirmation = (confirmed: boolean) => { if (confirmed && pendingClick && socket) { socket.emit('input:mousedown', pendingClick); - setLastAction('click'); + notifyLastAction('click'); } setShowConfirmation(false); setPendingClick(null);