diff options
| -rw-r--r-- | rectangles-drag.html (renamed from rectagnesl-drag.html) | 0 | ||||
| -rw-r--r-- | rectangles.html | 7 |
2 files changed, 3 insertions, 4 deletions
diff --git a/rectagnesl-drag.html b/rectangles-drag.html index 086ce27..086ce27 100644 --- a/rectagnesl-drag.html +++ b/rectangles-drag.html 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 |
