summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui/editor/WallpaperPicker.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-10-16 17:42:31 -0400
committerJules Laplace <jules@okfoc.us>2014-10-16 17:42:31 -0400
commit9880712797beedb5df936f3c740de79d549fca74 (patch)
treeda316af18c72601acc9f9781a38b64f77c25c249 /public/assets/javascripts/ui/editor/WallpaperPicker.js
parent4b2360ff6d7279df58d4fe5723fdf015d6577149 (diff)
move mega-tile behavior into wallpapepr picker
Diffstat (limited to 'public/assets/javascripts/ui/editor/WallpaperPicker.js')
-rw-r--r--public/assets/javascripts/ui/editor/WallpaperPicker.js23
1 files changed, 22 insertions, 1 deletions
diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js
index 116b725..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']")
@@ -161,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