feat: notify last action
This commit is contained in:
@@ -47,12 +47,18 @@ const ConfirmationBox = ({ selector, onYes, onNo }: { selector: string; onYes: (
|
||||
const Canvas = ({ width, height, onCreateRef, highlighterData }: CanvasProps) => {
|
||||
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||||
const { socket } = useSocketStore();
|
||||
const { setLastAction } = useGlobalInfoStore();
|
||||
const { setLastAction, lastAction } = useGlobalInfoStore();
|
||||
const [showConfirmation, setShowConfirmation] = useState(false);
|
||||
const [pendingClick, setPendingClick] = useState<Coordinates | null>(null);
|
||||
|
||||
const lastMousePosition = useRef<Coordinates>({ 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);
|
||||
|
||||
Reference in New Issue
Block a user