Browse Source

fix: triangle display

bdestombes 3 years ago
parent
commit
78f0bccd56
1 changed files with 3 additions and 2 deletions
  1. 3 2
      frontend/index.html

+ 3 - 2
frontend/index.html

@@ -143,11 +143,12 @@
 				 */
 
 				const canvas = document.getElementById('box');
+				canvas.width = screenW;
+				canvas.height = screenH;
 				context = canvas.getContext('2d');
 
 				const drawTriangle = (a, b, c) => {
-					// console.log(context, Math.round(a.x), Math.round(a.y), Math.round(b.x), Math.round(b.y), Math.round(c.x), Math.round(c.y));
-
+					context.clearRect(0, 0, canvas.width, canvas.height);
 					const path = new Path2D();
 					path.moveTo(Math.round(a.x), Math.round(a.y));
 					path.lineTo(Math.round(b.x), Math.round(b.y));