From abd50f1cfca26bb8e83275cfb443a2d678625aef Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 30 Jul 2014 19:28:41 -0400 Subject: handling basic cases for box outlines --- public/assets/javascripts/rectangles/util/sort.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'public/assets/javascripts/rectangles/util/sort.js') diff --git a/public/assets/javascripts/rectangles/util/sort.js b/public/assets/javascripts/rectangles/util/sort.js index 3b4771c..7aa40a2 100644 --- a/public/assets/javascripts/rectangles/util/sort.js +++ b/public/assets/javascripts/rectangles/util/sort.js @@ -84,13 +84,20 @@ .sort(compare_car) .map(cdr) } - sort.compare_z = function (a,b){ + sort.compare_rect_y = function (a,b){ return a.rect.y.a < b.rect.y.a ? -1 : a.rect.y.a == b.rect.y.a ? 0 : 1 } - sort.compare_x = function (a,b){ + sort.compare_rect_x = function (a,b){ return a.rect.x.a > b.rect.x.a ? -1 : a.rect.x.a == b.rect.x.a ? 0 : 1 } + sort.compare_x = function (a,b){ + return a.x < b.x ? -1 : a.x == b.x ? 0 : 1 + } + sort.compare_z = function (a,b){ + return a.z > b.z ? -1 : a.z == b.z ? 0 : 1 + } + if ("window" in this) { window.sort = sort } -- cgit v1.2.3-70-g09d2