summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/wall.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-10-07 12:11:43 -0400
committerJules Laplace <jules@okfoc.us>2014-10-07 12:11:43 -0400
commitd8637f78753af20022c9b6cd55717a5f905dd0ee (patch)
tree094004eea8d618e571383fac3f40afe944bdb406 /public/assets/javascripts/rectangles/models/wall.js
parent20b1d2787e71cb28c55187d42805407fef63d0e4 (diff)
splitting wallpaper url / position
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js24
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