summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-10-24 16:57:50 -0400
committerJules Laplace <jules@okfoc.us>2014-10-24 16:57:50 -0400
commit6fa1570122f2bae9abfaffc5ed90c8b6e36675ea (patch)
treec161582a8c79cd09591d414b905d3a19914497dd
parent79377c1a06e986abb9146f4a9b41e4d266dc8dfc (diff)
hit enter to flood, floods room, badaboom
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/_walls.js2
-rw-r--r--public/assets/javascripts/ui/editor/WallpaperPicker.js37
-rwxr-xr-xpublic/assets/stylesheets/app.css3
3 files changed, 30 insertions, 12 deletions
diff --git a/public/assets/javascripts/rectangles/engine/rooms/_walls.js b/public/assets/javascripts/rectangles/engine/rooms/_walls.js
index 653278c..25b1c58 100644
--- a/public/assets/javascripts/rectangles/engine/rooms/_walls.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/_walls.js
@@ -157,7 +157,7 @@
wall.wallpaper(background, img)
})
}.bind(this)
- img.src = background.src
+ img.src = background.src.replace("url(","").replace(")","")
img.complete && img.onload()
},
floor: function(background){
diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js
index 3b6168e..20fdf85 100644
--- a/public/assets/javascripts/ui/editor/WallpaperPicker.js
+++ b/public/assets/javascripts/ui/editor/WallpaperPicker.js
@@ -7,12 +7,12 @@ var WallpaperPicker = UploadView.extend({
uploadAction: "/api/media/upload",
events: {
- "contextmenu": 'cancel',
+ "contextmenu": 'contextmenu',
"mousedown": 'stopPropagation',
"click .swatch": 'pick',
"click .wallpaperRemove": 'remove',
"input [data-role='wallpaper-scale']": 'updateScale',
- "change .url": "tileWalls",
+ "change .url": "enterUrl",
"keydown .url": "enterSetUrl",
},
@@ -122,15 +122,21 @@ var WallpaperPicker = UploadView.extend({
}
},
- cancel: function(e){
+ contextmenu: function(e){
if (Scenery.nextWallpaper) {
e.preventDefault()
+ this.cancel()
+ }
+ },
+ cancel: function(){
+ if (Scenery.nextWallpaper) {
Scenery.nextWallpaper = null
app.tube('cancel-wallpaper')
}
},
follow: function(e, wallpaper, icon){
+ var base = this
icon = icon || wallpaper
var $floatingSwatch = $(".floatingSwatch")
@@ -139,6 +145,8 @@ var WallpaperPicker = UploadView.extend({
Scenery.nextWallpaper = wallpaper
+ $(".floodMessage").show()
+
setTimeout(function(){
function _followCursor(e) {
$floatingSwatch.css({
@@ -151,7 +159,12 @@ var WallpaperPicker = UploadView.extend({
// $(window).off('click', _hideCursor)
app.off('cancel-wallpaper', _hideCursor)
$floatingSwatch.removeClass("scissors").hide()
+ $(".floodMessage").hide()
}
+ function _floodRoom (e) {
+ base.flood()
+ }
+ $(window).on('keydown', _floodRoom)
$(window).on('mousemove', _followCursor)
// $(window).one('click', _hideCursor);
app.on('cancel-wallpaper', _hideCursor)
@@ -178,22 +191,26 @@ var WallpaperPicker = UploadView.extend({
this.wall.wallpaperPosition({ scale: scale })
},
- tileWalls: function(){
+ enterUrl: 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)
+ setTimeout(this.enterUrl.bind(this), 100)
}
},
+
+ flood: function(url){
+ url = url || Scenery.nextWallpaper
+ if (! url) return
+ Walls.setWallpaper.wall({ src: url })
+ Walls.setWallpaper.floor({ src: url })
+ Walls.setWallpaper.ceiling({ src: url })
+ this.cancel()
+ },
initializePositionCursor: function(){
var base = this
diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css
index e5b10e3..8e259ef 100755
--- a/public/assets/stylesheets/app.css
+++ b/public/assets/stylesheets/app.css
@@ -1706,7 +1706,8 @@ input[type="range"]::-webkit-slider-thumb {
display: none;
animation: flicker 0.2s infinite;
color: black;
- margin: 5px 5px 49px 5px;
+ float: left;
+ margin: 10px 5px 5px 5px;
font-size: 13px;
font-weight: 300;
text-align: center;