diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/draw/app.js | 15 | ||||
| -rw-r--r-- | tools/draw/index.html | 1 |
2 files changed, 7 insertions, 9 deletions
diff --git a/tools/draw/app.js b/tools/draw/app.js index 329a8fc..4c73d75 100644 --- a/tools/draw/app.js +++ b/tools/draw/app.js | |||
| @@ -57,17 +57,16 @@ window.addEventListener('load', function(evt) { | |||
| 57 | ctx.lineWidth = parseInt(button.dataset.value); | 57 | ctx.lineWidth = parseInt(button.dataset.value); |
| 58 | break; | 58 | break; |
| 59 | } | 59 | } |
| 60 | case 'clear': | ||
| 61 | { | ||
| 62 | let clear = confirm('Do you really want to clear canvas?'); | ||
| 63 | if (clear) { | ||
| 64 | ctx.clearRect(0, 0, canvas.width, canvas.height); | ||
| 65 | } | ||
| 66 | break; | ||
| 67 | } | ||
| 68 | } | 60 | } |
| 69 | }); | 61 | }); |
| 70 | 62 | ||
| 71 | }); | 63 | }); |
| 72 | 64 | ||
| 65 | document.addEventListener('keydown', function(evt) { | ||
| 66 | if (evt.keyCode == 8) { | ||
| 67 | ctx.clearRect(0, 0, canvas.width, canvas.height); | ||
| 68 | } | ||
| 69 | console.log(evt.keyCode); | ||
| 70 | }, false); | ||
| 71 | |||
| 73 | }); | 72 | }); |
diff --git a/tools/draw/index.html b/tools/draw/index.html index a022697..87ff1d2 100644 --- a/tools/draw/index.html +++ b/tools/draw/index.html | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | <button data-method="size" data-value="2">small</button> | 32 | <button data-method="size" data-value="2">small</button> |
| 33 | <button data-method="size" data-value="4">normal</button> | 33 | <button data-method="size" data-value="4">normal</button> |
| 34 | <button data-method="size" data-value="12">big</button> | 34 | <button data-method="size" data-value="12">big</button> |
| 35 | <button data-method="clear" data-value="">clear</button> | ||
| 36 | </nav> | 35 | </nav> |
| 37 | 36 | ||
| 38 | <script src="app.js"></script> | 37 | <script src="app.js"></script> |
