summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-17 18:14:38 -0400
committerJules Laplace <jules@okfoc.us>2014-06-17 18:14:38 -0400
commit345253cecbaaeaa1b43fdd2409490172f1108382 (patch)
treef0fe1a32769cd811744fb8f15cba90b3e071486e /public/assets/javascripts/rectangles/models
parent32932165724e9c9fa891cb58bac224c50d425340 (diff)
dragging new media between walls
Diffstat (limited to 'public/assets/javascripts/rectangles/models')
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index 6c20444..e327070 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -51,14 +51,17 @@ window.Wall = (function(){
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