diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-04-29 16:42:13 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-04-29 16:42:13 -0400 |
| commit | 277afee0a66822113de9db44c8a60256b5c8491a (patch) | |
| tree | f5d85c8ce895343b63a0560ac76ce1c200153751 /assets/javascripts/rectangles/models/wall.js | |
| parent | c89f1107041a4ac8a513e4e2e7c1c3da984b1c59 (diff) | |
need to rethink this gravity stuff later
Diffstat (limited to 'assets/javascripts/rectangles/models/wall.js')
| -rw-r--r-- | assets/javascripts/rectangles/models/wall.js | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/assets/javascripts/rectangles/models/wall.js b/assets/javascripts/rectangles/models/wall.js index 97083c7..8a3784b 100644 --- a/assets/javascripts/rectangles/models/wall.js +++ b/assets/javascripts/rectangles/models/wall.js @@ -59,50 +59,34 @@ window.Wall = (function(){ return true } - Wall.prototype.center_for = function(img, gravity){ - var left - gravity = gravity || 0 - + Wall.prototype.center_for = function(img){ + var major_axis, minor_axis if (this.side & FRONT_BACK) { major_axis = this.rect.x minor_axis = this.rect.y } else { - minor_axis = this.rect.x major_axis = this.rect.y + minor_axis = this.rect.x } - - // left side addition - if (gravity > 0) { - console.log("gravity left") - left = major_axis.b - img.width/2 - } - // right side addition - else if (gravity < 0) { - console.log("gravity right") - left = major_axis.a + img.width/2 - } - else { - left = major_axis.midpoint() - } - + switch (this.side) { case FRONT: - x = left + x = major_axis.midpoint() z = minor_axis.a + 10 break case BACK: - x = left + x = major_axis.midpoint() z = minor_axis.b - 10 break case LEFT: x = minor_axis.a + 10 - z = left + z = major_axis.midpoint() break case RIGHT: x = minor_axis.b - 10 - z = left + z = major_axis.midpoint() break } |
