summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/wall.js
diff options
context:
space:
mode:
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