From 8aede8cb98669537213eb267e8602dc3e8266c97 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 20 Jun 2014 12:14:51 -0400 Subject: preserve proportions on scale (also smoother now) --- public/assets/javascripts/rectangles/models/rect.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'public/assets/javascripts/rectangles/models/rect.js') 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) -- cgit v1.2.3-70-g09d2