1- import { MouseEvent as ReactMouseEvent , TouchEvent as ReactTouchEvent , useRef } from 'react' ;
2- import { RoomStatus } from '@troublepainter/core' ;
1+ import { PointerEvent , useRef } from 'react' ;
32import { Link } from 'react-router-dom' ;
43import { Canvas } from '@/components/canvas/CanvasUI' ;
54import { Logo } from '@/components/ui/Logo' ;
@@ -31,7 +30,7 @@ const PlaygroundPage = () => {
3130 canUndo,
3231 undo,
3332 redo,
34- } = useDrawing ( canvasRef , RoomStatus . DRAWING , {
33+ } = useDrawing ( canvasRef , true , {
3534 maxPixels : Number . MAX_SAFE_INTEGER ,
3635 } ) ;
3736
@@ -41,14 +40,14 @@ const PlaygroundPage = () => {
4140 onClick : ( ) => setCurrentColor ( color . backgroundColor ) ,
4241 } ) ) ;
4342
44- const handleDrawStart = ( e : ReactMouseEvent < HTMLCanvasElement > | ReactTouchEvent < HTMLCanvasElement > ) => {
43+ const handleDrawStart = ( e : PointerEvent < HTMLCanvasElement > ) => {
4544 const { canvas } = getCanvasContext ( canvasRef ) ;
4645 const point = getDrawPoint ( e , canvas ) ;
4746 const convertPoint = convertCoordinate ( point ) ;
4847 startDrawing ( convertPoint ) ;
4948 } ;
5049
51- const handleDrawMove = ( e : ReactMouseEvent < HTMLCanvasElement > | ReactTouchEvent < HTMLCanvasElement > ) => {
50+ const handleDrawMove = ( e : PointerEvent < HTMLCanvasElement > ) => {
5251 const { canvas } = getCanvasContext ( canvasRef ) ;
5352 const point = getDrawPoint ( e , canvas ) ;
5453 const convertPoint = convertCoordinate ( point ) ;
@@ -57,7 +56,7 @@ const PlaygroundPage = () => {
5756 continueDrawing ( convertPoint ) ;
5857 } ;
5958
60- const handleDrawLeave = ( e : ReactMouseEvent < HTMLCanvasElement > | ReactTouchEvent < HTMLCanvasElement > ) => {
59+ const handleDrawLeave = ( e : PointerEvent < HTMLCanvasElement > ) => {
6160 const { canvas } = getCanvasContext ( canvasRef ) ;
6261 const point = getDrawPoint ( e , canvas ) ;
6362 const convertPoint = convertCoordinate ( point ) ;
@@ -98,7 +97,6 @@ const PlaygroundPage = () => {
9897 canvasRef = { canvasRef }
9998 cursorCanvasRef = { cursorCanvasRef }
10099 isDrawable = { true }
101- isHidden = { false }
102100 colors = { colorsWithSelect }
103101 brushSize = { brushSize }
104102 setBrushSize = { setBrushSize }
0 commit comments