summaryrefslogtreecommitdiff
path: root/assets/javascripts/rectangles/models/wall.js
blob: 50ae0e8648654a6eb51496d94bf2025a0de21d7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
window.Wall = (function(){

	var Wall = function(opt){
		this.id = opt.id
		this.room = opt.room
		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(){
		return this.rect.toString()
	}

	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(){
		var base = this
		base.$walls = $( this.mx.map(function(mx){ return mx.el }) )
		base.$walls.bind({
			mouseover: function(){
			},
			mousemove: function(e){
			},
			mousedown: function(){
				base.$walls.css("background-color", choice(window.palettes.colors))
				console.log("zz")
			}
		})
	}

	return Wall

})()