summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/wall.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-06-18 01:09:36 -0400
committerJulie Lala <jules@okfoc.us>2014-06-18 01:09:36 -0400
commit7771ed9a92f3b0da66e633c829316ac904300713 (patch)
tree08e2bd9fbf8d6fd9ba3dae379e17ba9a1fca4adc /public/assets/javascripts/rectangles/models/wall.js
parent16558222941e1aebdefdd520bd70e06e80632d39 (diff)
parent345253cecbaaeaa1b43fdd2409490172f1108382 (diff)
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index 4270551..e327070 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -42,20 +42,26 @@ window.Wall = (function(){
mousedown: function(){
base.randomize_colors()
console.log(sidesToString(base.side))
+ if (Scenery.nextMedia) {
+ Scenery.addNextToWall(base)
+ }
}
})
}
Wall.prototype.bounds_for = function(img) {
var coord = this.side & FRONT_BACK ? this.rect.x : this.rect.y
- return new Rect( new vec2( coord.a + img.width/2, coord.b - img.width/2 ),
- new vec2( img.height/2, Rooms.list[this.room].height - img.height/2 ) )
+ var halfWidth = img.width/2 * img.scale
+ var halfHeight = img.height/2 * img.scale
+
+ return new Rect( new vec2( coord.a + halfWidth, coord.b - halfWidth ),
+ new vec2( halfHeight, Rooms.list[this.room].height - halfHeight ) )
}
Wall.prototype.fits = function(img){
- if (this.side & FRONT_BACK && this.rect.x.length() < img.width) {
+ if (this.side & FRONT_BACK && this.rect.x.length() < img.width * img.scale) {
return false
}
- if (this.side & LEFT_RIGHT && this.rect.y.length() < img.width) {
+ if (this.side & LEFT_RIGHT && this.rect.y.length() < img.width * img.scale) {
return false
}
return true