draw with pointer events

This commit is contained in:
Ruben van de Ven 2021-11-23 12:28:40 +01:00
parent ae76368d4d
commit 98a82b7d6a
2 changed files with 5 additions and 3 deletions

View file

@ -3,6 +3,8 @@
<head> <head>
<meta charset="utf-8"> <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> <title>Draw a line animation</title>
<style media="screen"> <style media="screen">
#sample, #sample,

View file

@ -31,9 +31,9 @@ class Canvas {
this.startTime = null; this.startTime = null;
document.body.addEventListener('mousemove', this.draw.bind(this)); document.body.addEventListener('pointermove', this.draw.bind(this));
document.body.addEventListener('mouseup', this.penup.bind(this)); document.body.addEventListener('pointerup', this.penup.bind(this));
this.svgEl.addEventListener('mousedown', this.startStroke.bind(this)); this.svgEl.addEventListener('pointerdown', this.startStroke.bind(this));
this.createToolbox(); this.createToolbox();