diff options
| author | Julie Lala <jules@okfoc.us> | 2014-04-27 02:12:28 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-04-27 02:12:28 -0400 |
| commit | 02dd0344889f45701021e86efef8d04b56175047 (patch) | |
| tree | 65d9eef3cd0461e427e090128d372c7d002e64e5 /assets/javascripts/rectangles/models/wall.js | |
| parent | fb7405f016f9f26b0fc81fb8a26dacd2b2350fa0 (diff) | |
group coincident walls
Diffstat (limited to 'assets/javascripts/rectangles/models/wall.js')
| -rw-r--r-- | assets/javascripts/rectangles/models/wall.js | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/assets/javascripts/rectangles/models/wall.js b/assets/javascripts/rectangles/models/wall.js index b9705a2..50ae0e8 100644 --- a/assets/javascripts/rectangles/models/wall.js +++ b/assets/javascripts/rectangles/models/wall.js @@ -3,9 +3,14 @@ window.Wall = (function(){ var Wall = function(opt){ this.id = opt.id this.room = opt.room - this.rect = opt.rect + this.rect = opt.rect || new Rect (0,0,0,0) + this.rect.sides = opt.side + this.side = opt.side this.mx = [] this.els = [] + if (opt.el) { + this.mx.push(opt.el) + } } Wall.prototype.toString = function(){ @@ -14,15 +19,24 @@ window.Wall = (function(){ Wall.prototype.reset = function(){ } + Wall.prototype.destroy = function(){ + this.mx.forEach(function(mx){ + mx.destroy && mx.destroy() + }) + this.room = this.rect = this.mx = this.els = null + } Wall.prototype.bind = function(){ - this.$walls.bind({ + var base = this + base.$walls = $( this.mx.map(function(mx){ return mx.el }) ) + base.$walls.bind({ mouseover: function(){ }, mousemove: function(e){ }, mousedown: function(){ - $(this).css("background-color", choice(window.palettes.colors)) + base.$walls.css("background-color", choice(window.palettes.colors)) + console.log("zz") } }) } |
