draw with pointer events
This commit is contained in:
parent
ae76368d4d
commit
98a82b7d6a
2 changed files with 5 additions and 3 deletions
|
@ -3,6 +3,8 @@
|
|||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' />
|
||||
<title>Draw a line animation</title>
|
||||
<style media="screen">
|
||||
#sample,
|
||||
|
|
|
@ -31,9 +31,9 @@ class Canvas {
|
|||
|
||||
this.startTime = null;
|
||||
|
||||
document.body.addEventListener('mousemove', this.draw.bind(this));
|
||||
document.body.addEventListener('mouseup', this.penup.bind(this));
|
||||
this.svgEl.addEventListener('mousedown', this.startStroke.bind(this));
|
||||
document.body.addEventListener('pointermove', this.draw.bind(this));
|
||||
document.body.addEventListener('pointerup', this.penup.bind(this));
|
||||
this.svgEl.addEventListener('pointerdown', this.startStroke.bind(this));
|
||||
|
||||
this.createToolbox();
|
||||
|
||||
|
|
Loading…
Reference in a new issue