Skip to content

Commit

Permalink
update copy canvas to small
Browse files Browse the repository at this point in the history
  • Loading branch information
deveshidwivedi committed Jun 20, 2024
1 parent b20ae4c commit e47f20e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/room/components/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ const Canvas = () => {
const y = useMotionValue(0);

const copyCanvasToSmall = () => {
if (canvasRef.current) {
smallCanvasRef.current
?.getContext("2d")
?.drawImage(
if (canvasRef.current && smallCanvasRef.current) {
const smallCtx = smallCanvasRef.current.getContext("2d");
if (smallCtx){
smallCtx.clearRect(0, 0, CANVAS_SIZE.width, CANVAS_SIZE.height);
smallCtx.drawImage(
canvasRef.current,
0,
0,
CANVAS_SIZE.width,
CANVAS_SIZE.height
);
}

}
};

Expand Down

0 comments on commit e47f20e

Please sign in to comment.