From 27203a7a6f8fea9d1301b0848132477a4bc1e790 Mon Sep 17 00:00:00 2001 From: cristian Date: Wed, 6 Aug 2014 23:19:46 +0200 Subject: [PATCH] Simplify resize method by reducing combinations --- .../element/resizing.module.coffee | 36 ++++--------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/assets/javascripts/app/controllers/element/resizing.module.coffee b/assets/javascripts/app/controllers/element/resizing.module.coffee index 8542537..e26a3f3 100644 --- a/assets/javascripts/app/controllers/element/resizing.module.coffee +++ b/assets/javascripts/app/controllers/element/resizing.module.coffee @@ -62,40 +62,18 @@ class Resizing extends Spine.Controller resize: (e, type, position, lockAR) -> area = @element.area() - switch type - when 'tl' - area.width -= position.left - area.height -= position.top + switch type[0] + when 't' area.top += position.top - area.left += position.left - - when 'tt' area.height -= position.top - area.top += position.top - - when 'tr' - area.width += position.left - area.height -= position.top - area.top += position.top - - when 'rr' - area.width += position.left - - when 'br' - area.width += position.left - area.height += position.top - - when 'bb' - area.height += position.top - - when 'bl' - area.width -= position.left + when 'b' area.height += position.top - area.left += position.left - - when 'll' + switch type[1] + when 'l' area.width -= position.left area.left += position.left + when 'r' + area.width += position.left if lockAR # TODO - FIXME, this doesn't lock AR properly