We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
on
1 parent fe1cf7a commit 8295ae5Copy full SHA for 8295ae5
src/index.js
@@ -35,8 +35,7 @@ export default class SignatureCanvas extends Component {
35
componentDidMount () {
36
this._ctx = this._canvas.getContext("2d");
37
38
- this._handleMouseEvents();
39
- this._handleTouchEvents();
+ this.on()
40
this._resizeCanvas();
41
this.clear()
42
}
@@ -142,6 +141,11 @@ export default class SignatureCanvas extends Component {
142
141
document.addEventListener('touchend', this._handleTouchEnd)
143
144
+ on = () => {
145
+ this._handleMouseEvents()
146
+ this._handleTouchEvents()
147
+ }
148
+
149
off = () => {
150
this._canvas.removeEventListener('mousedown', this._handleMouseDown)
151
this._canvas.removeEventListener('mousemove', this._handleMouseMove)
0 commit comments