summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js24
-rw-r--r--public/assets/javascripts/ui/editor/EditorView.js4
-rw-r--r--public/assets/javascripts/ui/reader/ReaderView.js4
3 files changed, 23 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
diff --git a/public/assets/javascripts/ui/editor/EditorView.js b/public/assets/javascripts/ui/editor/EditorView.js
index 67687fe..f95d909 100644
--- a/public/assets/javascripts/ui/editor/EditorView.js
+++ b/public/assets/javascripts/ui/editor/EditorView.js
@@ -52,6 +52,10 @@ var EditorView = View.extend({
}
},
+ pickWall: function(wall, pos){
+ this.hideExtras()
+ },
+
hideExtras: function(){
this.mediaEditor.hide()
this.textEditor.hide()
diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js
index 82db048..5f2db0f 100644
--- a/public/assets/javascripts/ui/reader/ReaderView.js
+++ b/public/assets/javascripts/ui/reader/ReaderView.js
@@ -78,6 +78,10 @@ var ReaderView = View.extend({
app.tube("pick-scenery", { scenery: scenery })
},
+ pickWall: function(wall, pos){
+ this.hideExtras()
+ },
+
hideExtras: function(){
this.mediaPlayer.hide()
app.tube("close-scenery")