summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/rectangles/models/wall.js
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-08-15 09:26:10 -0400
committerJulie Lala <jules@okfoc.us>2014-08-15 09:26:10 -0400
commitaecaf2de2b4ed5277b34e9209a0f31602e8a7999 (patch)
tree78e46648032b91ebb0267e38f39f6227da7d8732 /public/assets/javascripts/rectangles/models/wall.js
parent02bde51c24ae1c6e189d031b80226e6a9f7cbc59 (diff)
parent1be685f9fe4a7f3a3e947d45f865fe07c03ddbaf (diff)
Merge branch 'walls' of github.com:okfocus/vvalls into walls
Diffstat (limited to 'public/assets/javascripts/rectangles/models/wall.js')
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js30
1 files changed, 18 insertions, 12 deletions
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index fdc91fd..460963b 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -52,7 +52,16 @@
// base.randomize_colors()
// console.log(sidesToString(base.side))
if (Scenery.nextMedia) {
- Scenery.addNextToWall(base, mx)
+ var scenery = Scenery.addNextToWall(base)
+
+ UndoStack.push({
+ type: 'create-scenery',
+ undo: { id: scenery.id },
+ redo: scenery.serialize(),
+ })
+
+ // TODO: watch individual scenery object here
+ Minotaur.watch( app.router.editorView.settings )
}
else if (Scenery.nextWallpaper) {
base.wallpaper()
@@ -135,18 +144,15 @@
Wall.prototype.wallpaper = function(){
var useX = this.side & FRONT_BACK
var shouldFlip = this.side & (LEFT | BACK)
- this.siblings().forEach(function(w){
- w.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
+ 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 = Scenery.nextWallpaper
- mx.el.style.backgroundPosition = (~~partitionOffset) + "px " + (~~floorOffset) + "px"
- })
- })
+ mx.el.style.backgroundImage = Scenery.nextWallpaper
+ mx.el.style.backgroundPosition = (~~partitionOffset) + "px " + (~~floorOffset) + "px"
+ })
}
Wall.prototype.outline = function(){