From 464bd3bfe74695955239e176dce8fe885bba8ac3 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 27 Aug 2015 12:44:17 -0400 Subject: arrow tool can translate walls orthogonally --- .../assets/javascripts/rectangles/engine/shapes/ortho.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'public/assets/javascripts/rectangles/engine/shapes/ortho.js') diff --git a/public/assets/javascripts/rectangles/engine/shapes/ortho.js b/public/assets/javascripts/rectangles/engine/shapes/ortho.js index 8a8f928..c1acae5 100644 --- a/public/assets/javascripts/rectangles/engine/shapes/ortho.js +++ b/public/assets/javascripts/rectangles/engine/shapes/ortho.js @@ -33,6 +33,22 @@ var OrthoPolyline = Polyline.extend(function(base){ } } } + exports.translateSegment = function(src, dest, dx, dy) { + if (src[0].a == src[1].a) { + dest[0].a = src[0].a + dx + dest[1].a = src[1].a + dx + if (src.length == 3) { + dest[2].a = src[2].a + dx + } + } + else { + dest[0].b = src[0].b + dy + dest[1].b = src[1].b + dy + if (src.length == 3) { + dest[2].b = src[2].b + dy + } + } + } exports.close = function(){ this.points[this.points.length] = this.points[0] this.closed = true -- cgit v1.2.3-70-g09d2