diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-08-22 19:41:37 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-08-22 19:41:37 -0400 |
| commit | 2235c34e498499b8141e835998b962067583a0ce (patch) | |
| tree | 22406e6484a7cccc1c72fb47cc4e5848f57ee2c4 /public/assets/javascripts/rectangles/util/sort.js | |
| parent | ed5751766079a62ce596dcc0abc1a211b5b633dc (diff) | |
| parent | 4ef340497ef24bb2ecacb2c9c4106c24515c874f (diff) | |
merge
Diffstat (limited to 'public/assets/javascripts/rectangles/util/sort.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/util/sort.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/public/assets/javascripts/rectangles/util/sort.js b/public/assets/javascripts/rectangles/util/sort.js index 7aa40a2..cf8d6b1 100644 --- a/public/assets/javascripts/rectangles/util/sort.js +++ b/public/assets/javascripts/rectangles/util/sort.js @@ -95,9 +95,38 @@ 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 + return a.z < b.z ? -1 : a.z == b.z ? 0 : 1 } - + sort.compare_xz = function(a,b){ + if (a.x < b.x) { + return -1 + } + if (a.x > b.x) { + return 1 + } + if (a.z < b.z) { + return -1 + } + if (a.z > b.z) { + return 1 + } + return 0 + } + sort.compare_zx = function(a,b){ + if (a.z < b.z) { + return -1 + } + if (a.z > b.z) { + return 1 + } + if (a.x < b.x) { + return -1 + } + if (a.x > b.x) { + return 1 + } + return 0 + } if ("window" in this) { window.sort = sort } |
