diff --git a/modules/room/components/Canvas.tsx b/modules/room/components/Canvas.tsx index 86f6de6..b6daaae 100644 --- a/modules/room/components/Canvas.tsx +++ b/modules/room/components/Canvas.tsx @@ -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 ); + } + } };