Skip to content

Commit

Permalink
minor fixes, errors resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
deveshidwivedi committed Jun 21, 2024
1 parent cfdd222 commit 0911e25
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions modules/room/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useRef, useState, useEffect } from "react";
import { useKeyPressEvent } from "react-use";
import { useDraw, useSocketDraw } from "../hooks/Canvas.hooks";
import { socket } from "@/common/lib/socket";
import { drawFromSocket } from "../helpers/Canvas.helpers";
import Minimap from "./Minimap";

const Canvas = () => {
Expand Down Expand Up @@ -64,7 +63,7 @@ const Canvas = () => {
}
}, [dragging]);

useSocketDraw(ctx, copyCanvasToSmall);
useSocketDraw(ctx,drawing, copyCanvasToSmall);
return (
<div className="relative h-full w-full overflow-hidden">
<button className="absolute top-0" onClick={handleUndo}>
Expand Down
2 changes: 1 addition & 1 deletion modules/room/components/MousePosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const MousePosition = () => {
return (
<motion.div
ref={ref}
className="pointer-events-none absolute top-2 left-0 z-50 select-none"
className="pointer-events-none absolute top-2 left-0 z-50"
animate={{ x: docX + 15, y: docY + 15 }}
transition={{ duration: 0.05, ease: "linear" }}
>
Expand Down
4 changes: 2 additions & 2 deletions modules/room/components/MouseRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { socket } from "@/common/lib/socket";
import { useEffect, useState } from "react";
import SocketMouse from "./SocketMouse";
import UserMouse from "./UserMouse";
import { useUserIds } from "@/common/recoil/users";
//error prone
export const MouseRenderer = () => {
Expand All @@ -9,7 +9,7 @@ export const MouseRenderer = () => {
return (
<>
{userIds.map((userId)=>{
return <SocketMouse userId={userId} key={userId} />;
return <UserMouse userId={userId} key={userId} />;
})}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { socket } from "@/common/lib/socket";
import { motion } from "framer-motion";
import { BsCursorFill } from "react-icons/bs";

const SocketMouse = ({ userId }: { userId: string }) => {
const UserMouse = ({ userId }: { userId: string }) => {
const boardPos = useBoardPosition();
const [x, setX] = useState(boardPos.x.get());
const [y, setY] = useState(boardPos.y.get());
Expand All @@ -30,7 +30,7 @@ const SocketMouse = ({ userId }: { userId: string }) => {

return (
<motion.div
className={`absolute top-0 left-0 text-blue-800 ${pos.x === -1 && 'hidden'}`}
className={`absolute top-0 left-0 text-blue-800 ${pos.x === -1 && 'hidden'}pointer-events-none`}
animate={{ x: pos.x + x, y: pos.y + y }}
transition={{ duration: 0.3, ease: "linear" }}
>
Expand All @@ -39,4 +39,4 @@ const SocketMouse = ({ userId }: { userId: string }) => {
);
};

export default SocketMouse;
export default UserMouse;

0 comments on commit 0911e25

Please sign in to comment.