diff --git a/src/components/atoms/canvas.tsx b/src/components/atoms/canvas.tsx index b0a65fba..520c6d0b 100644 --- a/src/components/atoms/canvas.tsx +++ b/src/components/atoms/canvas.tsx @@ -47,12 +47,18 @@ const ConfirmationBox = ({ selector, onYes, onNo }: { selector: string; onYes: ( const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) => { const canvasRef = useRef(null); const { socket } = useSocketStore(); - const { setLastAction } = useGlobalInfoStore(); + const { setLastAction, lastAction } = useGlobalInfoStore(); const [showConfirmation, setShowConfirmation] = useState(false); const [pendingClick, setPendingClick] = useState(null); const lastMousePosition = useRef({ x: 0, y: 0 }); + const notifyLastAction = (action: string) => { + if (lastAction !== action) { + setLastAction(action); + } + }; + const onMouseEvent = useCallback((event: MouseEvent) => { if (socket && canvasRef.current) { const coordinates = getMappedCoordinates(event, canvasRef.current, width, height);