| 94 | |
| 95 | // Draw what is stored in DrawnArray |
| 96 | function restoreCanvas() { |
| 97 | for (let i = 1; i < drawnArray.length; i++) { |
| 98 | context.beginPath(); |
| 99 | context.moveTo(drawnArray[i - 1].x, drawnArray[i - 1].y); |
| 100 | context.lineWidth = drawnArray[i].size; |
| 101 | context.lineCap = 'round'; |
| 102 | if (drawnArray[i].eraser) { |
| 103 | context.strokeStyle = bucketColor; |
| 104 | } else { |
| 105 | context.strokeStyle = drawnArray[i].color; |
| 106 | } |
| 107 | context.lineTo(drawnArray[i].x, drawnArray[i].y); |
| 108 | context.stroke(); |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | // Store Drawn Lines in DrawnArray |
| 113 | function storeDrawn(x, y, size, color, erase) { |