From 4ec4b0e42c06b63962658ae8b886ee9466d09a21 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Fri, 22 Aug 2014 12:54:27 -0400 Subject: reject image if it doesnt fit --- .../assets/javascripts/rectangles/models/wall.js | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'public/assets/javascripts/rectangles/models/wall.js') 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 } -- cgit v1.2.3-70-g09d2