File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,17 @@ import Tools from './components/Tools';
88
99class App extends Component {
1010
11+ clearBoard = ( ) => {
12+ console . log ( "Clear Board" ) ;
13+ const context = document . getElementById ( 'canvas' ) . getContext ( '2d' ) ;
14+ context . clearRect ( 0 , 0 , context . canvas . width , context . canvas . height ) ;
15+ paint = false ;
16+ clickX = [ ] ;
17+ clickY = [ ] ;
18+ clickDrag = [ ] ;
19+
20+ }
21+
1122 render ( ) {
1223 return (
1324 < div >
@@ -21,7 +32,7 @@ class App extends Component {
2132 < Container >
2233 < Row >
2334 < Col className = "justify-content-center" >
24- < Tools />
35+ < Tools clearBoard = { this . clearBoard } />
2536 </ Col >
2637 </ Row >
2738 </ Container >
Original file line number Diff line number Diff line change 11import React from 'react'
22import { Button } from 'react-bootstrap'
33
4- function Tools ( ) {
4+ function Tools ( props ) {
55 return (
66 < div className = "text-center" >
77 < Button variant = "success btn-sm" data-target = "tooltip" title = "Save Paint" > Save</ Button > { ' ' }
@@ -21,7 +21,7 @@ function Tools() {
2121 < ion-icon name = "logo-facebook" > </ ion-icon >
2222 </ Button > { ' ' }
2323
24- < Button variant = "danger btn-sm" data-target = "tooltip" title = "Clear the Paint board" > Clear</ Button >
24+ < Button variant = "danger btn-sm" data-target = "tooltip" onClick = { props . clearBoard } title = "Clear the Paint board" > Clear</ Button >
2525 </ div >
2626 )
2727}
You can’t perform that action at this time.
0 commit comments