summaryrefslogtreecommitdiff
path: root/assets/test/lasso/index.html
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-11-18 15:36:17 -0500
committerJules Laplace <jules@okfoc.us>2014-11-18 15:36:17 -0500
commit24047fd4fea0f91aa66023434abc0030cf8dfb90 (patch)
tree7a2972fd42f8f7abeb6b44dfb1b283e2d7a5bc7b /assets/test/lasso/index.html
parent551dabc2e9f0202848fe000084fc4283272faed3 (diff)
making the point/vec2 naming more normal
Diffstat (limited to 'assets/test/lasso/index.html')
-rw-r--r--assets/test/lasso/index.html14
1 files changed, 7 insertions, 7 deletions
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()