diff options
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/wall.js | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js index 41d7235..bbe6b97 100644 --- a/public/assets/javascripts/rectangles/models/wall.js +++ b/public/assets/javascripts/rectangles/models/wall.js @@ -11,18 +11,14 @@ Rect = require('./rect') UidGenerator = require('../util/uid') } - var wall_uid = new UidGenerator({}) var Wall = function(opt){ this.id = opt.id - this.uid = wall_uid this.vec = opt.vec this.edge = opt.edge this.side = opt.side - this.mx = [] - if (opt.el) { - this.mx.push(opt.el) - } + this.faces = opt.faces + this.mx = opt.mx } Wall.prototype.toString = function(){ @@ -42,27 +38,30 @@ Wall.prototype.bind = function(){ var base = this base.$walls = $( this.mx.map(function(mx){ return mx.el }) ) - base.$walls.bind({ - mouseover: function(){ - }, - mouseenter: function(e){ - Scenery.mouse.mouseenter(e, base) - }, - mousemove: function(e){ - }, - mousedown: function(){ - // base.randomize_colors() - // console.log(sidesToString(base.side)) - if (Scenery.nextMedia) { - Scenery.addNextToWall(base) - } - else if (Scenery.nextWallpaper) { - base.wallpaper() - } - else { - app.controller.hideExtras() + + this.mx.forEach(function(mx){ + $(mx.el).bind({ + mouseover: function(){ + }, + mouseenter: function(e){ + Scenery.mouse.mouseenter(e, base, mx) + }, + mousemove: function(e){ + }, + mousedown: function(){ + // base.randomize_colors() + // console.log(sidesToString(base.side)) + if (Scenery.nextMedia) { + Scenery.addNextToWall(base, mx) + } + else if (Scenery.nextWallpaper) { + base.wallpaper() + } + else { + app.controller.hideExtras() + } } - } + }) }) this.outline() } @@ -77,6 +76,12 @@ new vec2( halfHeight, Rooms.list[this.room].height - halfHeight ) ) } + Wall.prototype.bounds_for_mx = function(img, scale, mx) { + // + } + Wall.prototype.fits_mx = function(img, scale, mx) { + } + Wall.prototype.fits = function(img, scale){ if (this.side & FRONT_BACK && this.rect.x.length() < img.width * scale) { return false @@ -165,7 +170,7 @@ mx.outlined = true canvas.width = mx.width canvas.height = mx.height - ctx.fillStyle = "rgba(255,255,255,0.9)" + ctx.fillStyle = "rgba(255,255,255,0.95)" ctx.fillRect(0, 0, canvas.width, canvas.height) ctx.fillStyle = "rgba(0,0,0,1.0)" |
