From 24047fd4fea0f91aa66023434abc0030cf8dfb90 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 18 Nov 2014 15:36:17 -0500 Subject: making the point/vec2 naming more normal --- assets/test/lasso/index.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'assets/test/lasso/index.html') diff --git a/assets/test/lasso/index.html b/assets/test/lasso/index.html index f136f6d..62a9744 100644 --- a/assets/test/lasso/index.html +++ b/assets/test/lasso/index.html @@ -28,22 +28,22 @@ var mymouse = new mouse({ down: function(e, cursor){ // compare to initial point if (placing) { - if (points.length > 2 && points[0].distanceTo({ a: cursor.x.a, b: cursor.y.a }) < 3) { + if (points.length > 2 && points[0].distanceTo(cursor.a) < 3) { points.push(points[0].clone()) placing = false } else { - points.push( new point( cursor.x.a, cursor.y.a ) ) + points.push( cursor.a ) } } else { placing = true points.length = 0 - points.push( new point( cursor.x.a, cursor.y.a ) ) + points.push( cursor.a ) } }, move: function(e, cursor){ - if (placing && points.length > 2 && points[0].distanceTo({ a: cursor.x.a, b: cursor.y.a }) < 3 ) { + if (placing && points.length > 2 && points[0].distanceTo(cursor.a) < 3 ) { document.body.style.cursor = "pointer" } else { @@ -62,15 +62,15 @@ function draw (time) { if (points.length == 1) { ctx.fillStyle = "#000" - ctx.fillRect(points[0].a, points[0].b, 1, 1) + ctx.fillRect(points[0].x, points[0].y, 1, 1) } if (points.length > 1) { ctx.fillStyle = "#000" ctx.strokeStyle = "#000" ctx.beginPath() - ctx.moveTo(points[0].a, points[0].b) + ctx.moveTo(points[0].x, points[0].y) points.forEach(function(point, i){ - i && ctx.lineTo(point.a, point.b) + i && ctx.lineTo(point.x, point.y) }) if (placing) { ctx.stroke() -- cgit v1.2.3-70-g09d2