summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/assets/javascripts/mx/extensions/mx.movements.js6
-rw-r--r--public/assets/javascripts/rectangles/engine/map/ui_editor.js2
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/_walls.js23
-rw-r--r--public/assets/javascripts/rectangles/models/room.js14
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js36
-rw-r--r--public/assets/javascripts/ui/builder/BuilderView.js5
-rw-r--r--public/assets/javascripts/ui/editor/Presets.js22
-rw-r--r--public/assets/javascripts/ui/editor/WallpaperPicker.js28
-rwxr-xr-xpublic/assets/stylesheets/app.css2
-rw-r--r--views/controls/editor/presets.ejs1
-rw-r--r--views/controls/editor/wallpaper.ejs1
11 files changed, 84 insertions, 56 deletions
diff --git a/public/assets/javascripts/mx/extensions/mx.movements.js b/public/assets/javascripts/mx/extensions/mx.movements.js
index 386819a..5b1e2de 100644
--- a/public/assets/javascripts/mx/extensions/mx.movements.js
+++ b/public/assets/javascripts/mx/extensions/mx.movements.js
@@ -139,15 +139,15 @@ MX.Movements = function (cam) {
app.controller.mediaViewer.hide()
$(".inuse").removeClass("inuse")
}
- else if (app.controller.colorControl.$el.hasClass('active')) {
+ else if (app.controller.colorControl && app.controller.colorControl.$el.hasClass('active')) {
app.controller.colorControl.hide()
$(".inuse").removeClass("inuse")
}
- else if (app.controller.wallpaperPicker.$el.hasClass('active')) {
+ else if (app.controller.wallpaperPicker && app.controller.wallpaperPicker.$el.hasClass('active')) {
app.controller.wallpaperPicker.hide()
$(".inuse").removeClass("inuse")
}
- else if (app.controller.presets.$el.hasClass('active')) {
+ else if (app.controller.presets && app.controller.presets.$el.hasClass('active')) {
app.controller.presets.hide()
$(".inuse").removeClass("inuse")
}
diff --git a/public/assets/javascripts/rectangles/engine/map/ui_editor.js b/public/assets/javascripts/rectangles/engine/map/ui_editor.js
index 9d69990..1ab9c73 100644
--- a/public/assets/javascripts/rectangles/engine/map/ui_editor.js
+++ b/public/assets/javascripts/rectangles/engine/map/ui_editor.js
@@ -235,7 +235,7 @@ Map.UI.Editor = function(map){
}, 250)
}
else {
- map.set_zoom(map.zoom_exponent - deltaY/20)
+ map.set_zoom(map.zoom_exponent + deltaY/20)
}
}
diff --git a/public/assets/javascripts/rectangles/engine/rooms/_walls.js b/public/assets/javascripts/rectangles/engine/rooms/_walls.js
index fe5913d..653278c 100644
--- a/public/assets/javascripts/rectangles/engine/rooms/_walls.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/_walls.js
@@ -126,11 +126,10 @@
var ceilingColor = rgb_string(Walls.colors.ceiling)
Walls.list.forEach(function(wall){
wall.outline(wallColor, outlineColor)
- // TODO: SET WALLPAPER HERE
})
- Rooms.forEach(function(room){
- room.setFloorColor(floorColor)
- room.setCeilingColor(ceilingColor)
+ Walls.floors.forEach(function(floor){
+ if (floor.ceiling) floor.color(ceilingColor)
+ else floor.color(floorColor)
})
}
@@ -181,16 +180,18 @@
wall.wallpaper("none")
})
},
+ outline: function(){
+ },
floor: function(){
Walls.floors.forEach(function(floor){
if (floor.ceiling) return
- wall.wallpaper("none")
+ floor.wallpaper("none")
})
},
ceiling: function(){
Walls.floors.forEach(function(floor){
if (! floor.ceiling) return
- wall.wallpaper("none")
+ floor.wallpaper("none")
})
},
}
@@ -223,16 +224,18 @@
floor: function(rgb){
var rgbColor = rgb_string(rgb)
Walls.colors.floor = rgb
- Rooms.forEach(function(room){
- room.setFloorColor(rgbColor)
+ Walls.floors.forEach(function(floor){
+ if (floor.ceiling) return
+ floor.color(rgbColor)
})
},
ceiling: function(rgb){
var rgbColor = rgb_string(rgb)
Walls.colors.ceiling = rgb
- Rooms.forEach(function(room){
- room.setCeilingColor(rgbColor)
+ Walls.floors.forEach(function(floor){
+ if (! floor.ceiling) return
+ floor.color(rgbColor)
})
},
}
diff --git a/public/assets/javascripts/rectangles/models/room.js b/public/assets/javascripts/rectangles/models/room.js
index 1a4606c..b0344a1 100644
--- a/public/assets/javascripts/rectangles/models/room.js
+++ b/public/assets/javascripts/rectangles/models/room.js
@@ -158,19 +158,7 @@
})
return collision
}
-
- Room.prototype.setFloorColor = function(rgbColor) {
- this.mx_floor.map(function(mx){
- mx.el.style.backgroundColor = rgbColor
- })
- }
-
- Room.prototype.setCeilingColor = function(rgbColor) {
- this.mx_ceiling.map(function(mx){
- mx.el.style.backgroundColor = rgbColor
- })
- }
-
+
if ('window' in this) {
window.Room = Room
}
diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index eb445a7..75814dc 100644
--- a/public/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
@@ -67,7 +67,39 @@
}
},
*/
+ contextmenu: function(e){
+ if (! (e.ctrlKey || e.metaKey || e.shiftKey) ) {
+ e.preventDefault()
+ }
+ if (Scenery.nextMedia) {
+ e.preventDefault()
+ Scenery.nextMedia = null
+ app.tube('cancel-scenery')
+ }
+ else if (Scenery.nextWallpaper) {
+ e.preventDefault()
+ Scenery.nextWallpaper = null
+ app.tube('cancel-wallpaper')
+ }
+ },
+
mousedown: function(e){
+
+ // right-click
+ if (e.which == 3) {
+ if (Scenery.nextMedia) {
+ e.preventDefault()
+ Scenery.nextMedia = null
+ app.tube('cancel-scenery')
+ }
+ else if (Scenery.nextWallpaper) {
+ e.preventDefault()
+ Scenery.nextWallpaper = null
+ app.tube('cancel-wallpaper')
+ }
+ return
+ }
+
var offset = offsetFromPoint(e, mx.el)
if (! offset) { return }
@@ -120,7 +152,7 @@
else {
app.controller.pickWall(base, pos)
}
- }
+ },
})
})
@@ -250,7 +282,7 @@
url = "url(" + url + ")"
}
this.mx.forEach(function(mx){
- mx.el.style.backgroundImage = url
+ if (mx.el) mx.el.style.backgroundImage = url
})
}
diff --git a/public/assets/javascripts/ui/builder/BuilderView.js b/public/assets/javascripts/ui/builder/BuilderView.js
index 735274e..9b7e1a2 100644
--- a/public/assets/javascripts/ui/builder/BuilderView.js
+++ b/public/assets/javascripts/ui/builder/BuilderView.js
@@ -31,6 +31,9 @@ var BuilderView = View.extend({
},
hideExtras: function(){
- }
+ },
+
+ pickWall: function(wall, pos){
+ },
})
diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js
index 0a0e0fe..be86af3 100644
--- a/public/assets/javascripts/ui/editor/Presets.js
+++ b/public/assets/javascripts/ui/editor/Presets.js
@@ -5,8 +5,6 @@ var Presets = View.extend({
"mousedown": "stopPropagation",
"click .presets span": "selectPreset",
"click .swatches span": "selectColor",
- "change .url": "tileWalls",
- "keydown .url": "enterSetUrl",
},
presets: {
@@ -46,8 +44,6 @@ var Presets = View.extend({
initialize: function(opt){
this.parent = opt.parent
- this.$url = this.$(".url")
-
this.$presets = this.$(".presets")
_.keys(this.presets).forEach(function(name){
var $swatch = $("<span>")
@@ -91,7 +87,7 @@ var Presets = View.extend({
Walls.setColor[mode](preset[mode].color)
}
else {
- if (! this.lastPreset[mode].length) {
+ if (preset[mode].length) {
Walls.clearWallpaper[mode]()
}
Walls.setColor[mode](preset[mode])
@@ -102,21 +98,5 @@ var Presets = View.extend({
Walls.setBodyColor()
this.lastPreset = preset
},
-
- tileWalls: function(){
- var url = this.$url.sanitize()
- if (url.length && url.indexOf("http://") == 0) {
- Walls.setWallpaper.wall({ src: url })
- Walls.setWallpaper.floor({ src: url })
- Walls.setWallpaper.ceiling({ src: url })
- }
- app.controller.wallpaperPicker.addUrl(url)
- },
- enterSetUrl: function (e) {
- e.stopPropagation()
- if (e.keyCode == 13) {
- setTimeout(this.tileWalls.bind(this), 100)
- }
- },
}) \ No newline at end of file
diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js
index afdfca7..b26a5dc 100644
--- a/public/assets/javascripts/ui/editor/WallpaperPicker.js
+++ b/public/assets/javascripts/ui/editor/WallpaperPicker.js
@@ -11,6 +11,8 @@ var WallpaperPicker = UploadView.extend({
"click .swatch": 'pick',
"click .wallpaperRemove": 'remove',
"input [data-role='wallpaper-scale']": 'updateScale',
+ "change .url": "tileWalls",
+ "keydown .url": "enterSetUrl",
},
initialize: function(opt){
@@ -20,6 +22,8 @@ var WallpaperPicker = UploadView.extend({
this.$remove = this.$(".wallpaperRemove")
this.$remove.hide()
+ this.$url = this.$(".url")
+
this.$position = this.$("[data-role='wallpaper-position']")
this.$scale = this.$("[data-role='wallpaper-scale']")
@@ -38,6 +42,7 @@ var WallpaperPicker = UploadView.extend({
// },
toggle: function (state) {
+ Scenery.nextWallpaper = null
app.tube('cancel-wallpaper')
this.$el.toggleClass("active", state)
if (state) {
@@ -134,7 +139,7 @@ var WallpaperPicker = UploadView.extend({
}
function _hideCursor (e) {
$(window).off('mousemove', _followCursor)
- $(window).off('click', _hideCursor)
+ // $(window).off('click', _hideCursor)
app.off('cancel-wallpaper', _hideCursor)
$floatingSwatch.removeClass("scissors").hide()
}
@@ -145,7 +150,7 @@ var WallpaperPicker = UploadView.extend({
_followCursor(e);
})
},
-
+
wall: null,
pickWall: function(wall){
if (! wall.background || wall.background.src == "none") {
@@ -160,7 +165,24 @@ var WallpaperPicker = UploadView.extend({
s = parseFloat(this.$scale.val())
this.wall.wallpaperPosition({ scale: s })
},
-
+
+ tileWalls: function(){
+ var url = this.$url.sanitize()
+ if (url.length && url.indexOf("http") == 0) {
+ Walls.setWallpaper.wall({ src: url })
+ Walls.setWallpaper.floor({ src: url })
+ Walls.setWallpaper.ceiling({ src: url })
+ }
+ this.addUrl(url)
+ this.$url.val("")
+ },
+ enterSetUrl: function (e) {
+ e.stopPropagation()
+ if (e.keyCode == 13) {
+ setTimeout(this.tileWalls.bind(this), 100)
+ }
+ },
+
initializePositionCursor: function(){
var base = this
var dx = 0, dy = 0, dragging = false, delta
diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css
index 4548304..e3da969 100755
--- a/public/assets/stylesheets/app.css
+++ b/public/assets/stylesheets/app.css
@@ -1700,7 +1700,7 @@ input[type="range"]::-webkit-slider-thumb {
width: 100%;
color: #555;
}
-#presets .url {
+.wallpaper .url {
margin: 4px 0;
padding: 2px;
font-size: 12px;
diff --git a/views/controls/editor/presets.ejs b/views/controls/editor/presets.ejs
index 02e9d42..04b1cf1 100644
--- a/views/controls/editor/presets.ejs
+++ b/views/controls/editor/presets.ejs
@@ -2,5 +2,4 @@
<h4>Preset Styles</h4>
<div class="presets">
</div>
- <input type="text" class="url" placeholder="enter a url">
</div>
diff --git a/views/controls/editor/wallpaper.ejs b/views/controls/editor/wallpaper.ejs
index 39a109b..ed175ae 100644
--- a/views/controls/editor/wallpaper.ejs
+++ b/views/controls/editor/wallpaper.ejs
@@ -32,6 +32,7 @@
<label>Resize Wallpaper</label>
</div>
-->
+ <input type="text" class="url" placeholder="enter a url">
<div class="wallpaperResizeControls">
<span data-role="wallpaper-position" class="ion-arrow-expand"></span>