diff options
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
| -rw-r--r-- | public/assets/javascripts/rectangles/models/wall.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js index dc38183..dedae8b 100644 --- a/public/assets/javascripts/rectangles/models/wall.js +++ b/public/assets/javascripts/rectangles/models/wall.js @@ -68,12 +68,12 @@ }, */ mousedown: function(e){ - if (Scenery.nextMedia) { - var offset = offsetFromPoint(e, mx.el) - if (! offset) { return } + var offset = offsetFromPoint(e, mx.el) + if (! offset) { return } - var pos = base.mxOffsetToPosition( offset, index ) + var pos = base.mxOffsetToPosition( offset, index ) + if (Scenery.nextMedia) { var scenery = Scenery.addNextToWall({ wall: base, index: index, @@ -116,7 +116,7 @@ Minotaur.watch( app.router.editorView.settings ) } else { - app.controller.hideExtras() + app.controller.pickWall(base, pos) } } }) @@ -140,6 +140,7 @@ Wall.prototype.deserialize = function(data){ this.wallpaper( data.background ) + this.wallpaperPosition( data.background_x, data.background_y, data.background_scale ) } @@ -214,22 +215,27 @@ } Wall.prototype.wallpaper = function(background){ + this.background = background || "none" + this.mx.forEach(function(mx){ + mx.el.style.backgroundImage = background + }) + } + + Wall.prototype.wallpaperPosition = function(x, y, scale){ var useX = this.side & FRONT_BACK var shouldFlip = this.side & (LEFT | BACK) - - this.background = background || "none" - + this.mx.forEach(function(mx){ var partitionOffset = useX ? mx.x : mx.z if (shouldFlip) partitionOffset *= -1 partitionOffset += mx.width/2 var floorOffset = mx.y + mx.height/2 - mx.el.style.backgroundImage = background mx.el.style.backgroundPosition = (~~partitionOffset) + "px " + (~~floorOffset) + "px" }) } + Wall.prototype.outline = function(wallColor, outlineColor){ var useX = this.side & FRONT_BACK var mx = this.mx |
