From 5a8fb819126f9b1d9244cd3558a54a7d16b6858e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 11 Apr 2014 11:46:55 -0400 Subject: abs --- rectagnesl-drag.html | 246 --------------------------------------------------- rectangles-drag.html | 246 +++++++++++++++++++++++++++++++++++++++++++++++++++ rectangles.html | 7 +- 3 files changed, 249 insertions(+), 250 deletions(-) delete mode 100644 rectagnesl-drag.html create mode 100644 rectangles-drag.html diff --git a/rectagnesl-drag.html b/rectagnesl-drag.html deleted file mode 100644 index 086ce27..0000000 --- a/rectagnesl-drag.html +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - -
-
- -
- - - - - diff --git a/rectangles-drag.html b/rectangles-drag.html new file mode 100644 index 0000000..086ce27 --- /dev/null +++ b/rectangles-drag.html @@ -0,0 +1,246 @@ + + + + + + + + +
+
+ +
+ + + + + diff --git a/rectangles.html b/rectangles.html index 8878985..b6f4ca9 100644 --- a/rectangles.html +++ b/rectangles.html @@ -32,7 +32,7 @@ vec2.prototype.length = function(){ vec2.prototype.clone = function(){ return new vec2(this.a, this.b) } -vec2.prototype.normalize = function(){ +vec2.prototype.abs = function(){ if (this.b < this.a) { this.a = this.a ^ this.b this.b = this.a ^ this.b @@ -99,8 +99,8 @@ rect.prototype.center = function(){ return new vec2(this.x.midpoint(), this.y.midpoint()) } rect.prototype.normalize = function(){ - this.x.normalize().add(this.translation.a) - this.y.normalize().add(this.translation.b) + this.x.abs().add(this.translation.a) + this.y.abs().add(this.translation.b) this.translation.a = this.translation.b = 0 return this } @@ -149,7 +149,6 @@ canvas.addEventListener("mousedown", function(e){ else { creating = true } - }) canvas.addEventListener("mousemove", function(e){ mouse.x.b = e.pageX -- cgit v1.2.3-70-g09d2