summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/models/room.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/rectangles/models/room.js')
-rw-r--r--assets/javascripts/rectangles/models/room.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/assets/javascripts/rectangles/models/room.js b/assets/javascripts/rectangles/models/room.js
index f7c52d4..3c41a1b 100644
--- a/assets/javascripts/rectangles/models/room.js
+++ b/assets/javascripts/rectangles/models/room.js
@@ -29,19 +29,21 @@ window.Room = (function(){
this.constructed = false
this.walls = []
- this.floor = []
- this.ceiling = []
+
+ this.mx_walls = []
+ this.mx_floor = []
+ this.mx_ceiling = []
}
Room.prototype.bind = function(){
var base = this
- base.walls.forEach(function(wall){
+ base.mx_walls.forEach(function(wall){
$(wall.el).bind({
mouseover: function(){
},
mousemove: function(e){
var color = choice(window.palettes.colors)
- base.walls.forEach(function(wall){
+ base.mx_walls.forEach(function(wall){
$(wall.el).css("background-color", color)
})
},
@@ -51,11 +53,12 @@ window.Room = (function(){
})
}
- Room.prototype.group_walls = function(){
+ Room.prototype.group_mx_walls = function(){
var base = this
var side_groups = {}, walls = []
- base.walls.forEach(function(wall){
+ // group the walls by side
+ base.mx_walls.forEach(function(wall){
// ignore half-walls for now
if (! wall.side) return;
@@ -68,10 +71,10 @@ window.Room = (function(){
}
})
+ // sort the subgroups, and then combine mx objects under wall objects
pairs(side_groups).forEach(function(pair){
var side = pair[0], els = pair[1]
- console.log(sidesToString(side))
if (side & LEFT_RIGHT) {
els.sort(compare_x)
console.log(els.map(function(r){ return r.rect+"" }).join("\n"))
@@ -84,7 +87,6 @@ window.Room = (function(){
walls.push(wall)
els.forEach(function(el){
- console.log(wall.rect.x.b, el.rect.x.a, el.rect.sides & LEFT_RIGHT)
if (side & FRONT_BACK && wall.rect.x.b == el.rect.x.a) {
wall.rect.x.b = el.rect.x.b
wall.mx.push(el)
@@ -98,7 +100,6 @@ window.Room = (function(){
walls.push(wall)
}
})
- console.log(walls.length)
})
function new_wall (el) {