@@ -45,6 +45,7 @@ const dimensionsPropTypes = PropTypes.oneOfType([
45
45
46
46
export default class extends PureComponent {
47
47
static propTypes = {
48
+ onChange : PropTypes . func ,
48
49
loadTimeOffset : PropTypes . number ,
49
50
lazyRadius : PropTypes . number ,
50
51
brushRadius : PropTypes . number ,
@@ -62,6 +63,7 @@ export default class extends PureComponent {
62
63
} ;
63
64
64
65
static defaultProps = {
66
+ onChange : null ,
65
67
loadTimeOffset : 5 ,
66
68
lazyRadius : 12 ,
67
69
brushRadius : 10 ,
@@ -173,6 +175,7 @@ export default class extends PureComponent {
173
175
const lines = this . lines . slice ( 0 , - 1 ) ;
174
176
this . clear ( ) ;
175
177
this . simulateDrawingLines ( { lines, immediate : true } ) ;
178
+ this . triggerOnChange ( )
176
179
} ;
177
180
178
181
getSaveData = ( ) => {
@@ -436,8 +439,14 @@ export default class extends PureComponent {
436
439
437
440
// Clear the temporary line-drawing canvas
438
441
this . ctx . temp . clearRect ( 0 , 0 , width , height ) ;
442
+
443
+ this . triggerOnChange ( )
439
444
} ;
440
445
446
+ triggerOnChange = ( ) => {
447
+ this . props . onChange && this . props . onChange ( this )
448
+ }
449
+
441
450
clear = ( ) => {
442
451
this . lines = [ ] ;
443
452
this . valuesChanged = true ;
@@ -460,7 +469,7 @@ export default class extends PureComponent {
460
469
const pointer = this . lazy . getPointerCoordinates ( ) ;
461
470
const brush = this . lazy . getBrushCoordinates ( ) ;
462
471
463
- this . drawInterface ( this . ctx . interface , pointer , brush ) ;
472
+ // this.drawInterface(this.ctx.interface, pointer, brush);
464
473
this . mouseHasMoved = false ;
465
474
this . valuesChanged = false ;
466
475
}
0 commit comments