Created
March 7, 2021 18:13
-
-
Save piotrrussw/9b1a018c0cc5157ce1b048478b0d3bd9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ReactCanvasPaint(props) { | |
const canvas = useRef(null) | |
const [drawing, setDrawing] = useState(false) | |
const [position, setPosition] = useState(null) | |
return ( | |
<canvas | |
ref={canvas} | |
onMouseDown={onDown} | |
onTouchStart={onDown} | |
onMouseUp={onUp} | |
onTouchEnd={onUp} | |
onMouseLeave={onUp} | |
onMouseMove={onMove} | |
onTouchMove={onMove} | |
width={props.width} | |
height={props.height} | |
/> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment