diff options
| author | Julie Lala <jules@okfoc.us> | 2014-08-22 12:54:27 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-08-22 12:54:27 -0400 |
| commit | 4ec4b0e42c06b63962658ae8b886ee9466d09a21 (patch) | |
| tree | 5e3b0a52d61efa91495932f8cfe53a02dbe95af7 /public/assets/javascripts/rectangles/models | |
| parent | 978634c1c323240f36548468703a9512710c60e7 (diff) | |
reject image if it doesnt fit
Diffstat (limited to 'public/assets/javascripts/rectangles/models')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/surface.js | 3 | ||||
| -rw-r--r-- | public/assets/javascripts/rectangles/models/wall.js | 25 |
2 files changed, 11 insertions, 17 deletions
diff --git a/public/assets/javascripts/rectangles/models/surface.js b/public/assets/javascripts/rectangles/models/surface.js index a700fd4..9c45eaf 100644 --- a/public/assets/javascripts/rectangles/models/surface.js +++ b/public/assets/javascripts/rectangles/models/surface.js @@ -150,9 +150,6 @@ Surface.prototype.index_for_x = function(x, min_i){ min_i = min_i || 0 - if (x < 0 || x > this.width) { - return -1 - } for (var i = min_i; i < this.faces.length; i++) { if (this.faces[i].x.contains(x)) { return i diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js index a8bcbd8..f6742ad 100644 --- a/public/assets/javascripts/rectangles/models/wall.js +++ b/public/assets/javascripts/rectangles/models/wall.js @@ -51,9 +51,7 @@ }, mousemove: function(e){ }, - mousedown: function(){ - // base.randomize_colors() - // console.log(sidesToString(base.side)) + mousedown: function(e){ if (Scenery.nextMedia) { var scenery = Scenery.addNextToWall({ wall: base, @@ -61,7 +59,10 @@ }) // scenery was not placed - if (! scenery) return + if (! scenery) { + e.stopPropagation() + return + } UndoStack.push({ type: 'create-scenery', @@ -125,22 +126,18 @@ var position = new vec2(0,0) switch (this.side) { case FRONT: - position.a = mx.x - mx.width / 2 - position.b = mx.y - mx.height / 2 - break case BACK: - position.a = mx.x - mx.width / 2 - position.b = mx.y - mx.height / 2 + position.a = mx.x + position.b = mx.y break case LEFT: - position.a = mx.z - mx.width / 2 - position.b = mx.y - mx.height / 2 - break case RIGHT: - position.a = mx.z - mx.width / 2 - position.b = mx.y - mx.height / 2 + position.a = mx.z + position.b = mx.y break } +// if (mx.width) { position.a -= mx.width / 2 } +// if (mx.height) { position.b -= mx.height / 2 } return position } |
