summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/rect.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-20 12:14:51 -0400
committerJules Laplace <jules@okfoc.us>2014-06-20 12:14:51 -0400
commit8aede8cb98669537213eb267e8602dc3e8266c97 (patch)
treece5397403a63a7129e765585830e499ab3e19112 /public/assets/javascripts/rectangles/models/rect.js
parent1a1009d5cbfb1deb7cc110bacf3fd76236cf25a9 (diff)
preserve proportions on scale (also smoother now)
Diffstat (limited to 'public/assets/javascripts/rectangles/models/rect.js')
-rw-r--r--public/assets/javascripts/rectangles/models/rect.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/public/assets/javascripts/rectangles/models/rect.js b/public/assets/javascripts/rectangles/models/rect.js
index 0bab0e4..a4fbd87 100644
--- a/public/assets/javascripts/rectangles/models/rect.js
+++ b/public/assets/javascripts/rectangles/models/rect.js
@@ -28,6 +28,9 @@ window.Rect = (function(){
Rect.prototype.magnitude = function(){
return dist(this.x.a, this.y.a, this.x.b, this.y.b)
}
+ Rect.prototype.maxDimension = function(){
+ return abs(this.width) > abs(this.height) ? this.width : this.height
+ }
Rect.prototype.mul = function(n){
this.x.mul(n)