From e2de422ece0c98c2dbea41e7156455dcf91b9db4 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 20 Oct 2014 15:11:30 -0400 Subject: fix preset bug --- public/assets/javascripts/ui/editor/Presets.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'public/assets/javascripts/ui') diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js index ab311ef..d233144 100644 --- a/public/assets/javascripts/ui/editor/Presets.js +++ b/public/assets/javascripts/ui/editor/Presets.js @@ -82,14 +82,17 @@ var Presets = View.extend({ lastPreset: {wall:[1],outline:[1],floor:[1],ceiling:[1]}, load: function(preset){ this.parent.colorControl.modes.forEach(function(mode){ + var color if (! preset[mode].length) { Walls.setWallpaper[mode](preset[mode]) + color = preset[mode].color } else { Walls.clearWallpaper[mode]() - } - Walls.setColor[mode](preset[mode]) - this.parent.colorControl.$swatch[ mode ].css("background-color", rgb_string(preset[mode])) + color = preset[mode] + } + Walls.setColor[mode](color) + this.parent.colorControl.$swatch[ mode ].css("background-color", rgb_string(color)) }.bind(this)) this.parent.colorControl.setMode(preset.wall.color ? "wall" : "floor") Walls.setBodyColor() -- cgit v1.2.3-70-g09d2 From b21cb665e3ca296b56d389d3a2f83434f4646f26 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 20 Oct 2014 16:42:08 -0400 Subject: logarithmic wallpaper scale --- public/assets/javascripts/rectangles/models/floor.js | 5 +++-- public/assets/javascripts/rectangles/models/wall.js | 7 ++++--- public/assets/javascripts/ui/editor/WallpaperPicker.js | 10 +++++----- views/controls/editor/wallpaper.ejs | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) (limited to 'public/assets/javascripts/ui') diff --git a/public/assets/javascripts/rectangles/models/floor.js b/public/assets/javascripts/rectangles/models/floor.js index 2fb870f..ac1f8c9 100644 --- a/public/assets/javascripts/rectangles/models/floor.js +++ b/public/assets/javascripts/rectangles/models/floor.js @@ -146,8 +146,9 @@ Floor.prototype.wallpaperPosition = function(background){ if (this.background.src == "none") { return } - this.background.x = background.x || this.background.x - this.background.y = background.y || this.background.y + + this.background.x = background.x || this.background.x || 0 + this.background.y = background.y || this.background.y || 0 this.background.scale = background.scale || this.background.scale || 1 var mx, dx, dy diff --git a/public/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js index 75814dc..8590de7 100644 --- a/public/assets/javascripts/rectangles/models/wall.js +++ b/public/assets/javascripts/rectangles/models/wall.js @@ -288,10 +288,11 @@ Wall.prototype.wallpaperPosition = function(background){ if (this.background.src == "none") { return } - this.background.x = background.x || this.background.x - this.background.y = background.y || this.background.y + + this.background.x = background.x || this.background.x || 0 + this.background.y = background.y || this.background.y || 0 this.background.scale = background.scale || this.background.scale || 1 - + var mx, dx, dy var w = Math.round( this.backgroundImage.naturalWidth * this.background.scale ) var h = Math.round( this.backgroundImage.naturalHeight * this.background.scale ) diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js index b26a5dc..8f701b0 100644 --- a/public/assets/javascripts/ui/editor/WallpaperPicker.js +++ b/public/assets/javascripts/ui/editor/WallpaperPicker.js @@ -157,13 +157,13 @@ var WallpaperPicker = UploadView.extend({ return; } this.wall = wall - this.$scale.val( this.wall.background.scale ) + this.$scale.val( Math.log( this.wall.background.scale ) ) }, updateScale: function(){ if (! this.wall) return; - s = parseFloat(this.$scale.val()) - this.wall.wallpaperPosition({ scale: s }) + var scale = Math.exp( parseFloat(this.$scale.val()) ) + this.wall.wallpaperPosition({ scale: scale }) }, tileWalls: function(){ @@ -192,7 +192,7 @@ var WallpaperPicker = UploadView.extend({ down: function(e, cursor){ if (! base.wall) return dragging = true - s = parseFloat( base.$scale.val() ) + // s = parseFloat( base.$scale.val() ) x = base.wall.background.x y = base.wall.background.y }, @@ -203,7 +203,7 @@ var WallpaperPicker = UploadView.extend({ dx = delta.a*s dy = delta.b*s base.wall.wallpaperPosition({ - scale: s, + // scale: s, x: x+dx, y: y+dy, }) diff --git a/views/controls/editor/wallpaper.ejs b/views/controls/editor/wallpaper.ejs index 69a60ec..d2559cc 100644 --- a/views/controls/editor/wallpaper.ejs +++ b/views/controls/editor/wallpaper.ejs @@ -25,7 +25,7 @@
- +
-- cgit v1.2.3-70-g09d2 From 6dadb217e8253138936d4f5180f9cefa6e7caed9 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 20 Oct 2014 16:57:56 -0400 Subject: disable wallpaper resize controls --- public/assets/javascripts/ui/editor/WallpaperPicker.js | 5 +++++ public/assets/stylesheets/app.css | 4 ++++ 2 files changed, 9 insertions(+) (limited to 'public/assets/javascripts/ui') diff --git a/public/assets/javascripts/ui/editor/WallpaperPicker.js b/public/assets/javascripts/ui/editor/WallpaperPicker.js index 8f701b0..994fe74 100644 --- a/public/assets/javascripts/ui/editor/WallpaperPicker.js +++ b/public/assets/javascripts/ui/editor/WallpaperPicker.js @@ -27,6 +27,9 @@ var WallpaperPicker = UploadView.extend({ this.$position = this.$("[data-role='wallpaper-position']") this.$scale = this.$("[data-role='wallpaper-scale']") + this.$wallpaperResizeControls = this.$(".wallpaperResizeControls") + this.$wallpaperResizeControls.addClass('disabled') + this.initializePositionCursor() }, @@ -154,8 +157,10 @@ var WallpaperPicker = UploadView.extend({ wall: null, pickWall: function(wall){ if (! wall.background || wall.background.src == "none") { + this.$wallpaperResizeControls.addClass('disabled') return; } + this.$wallpaperResizeControls.removeClass('disabled') this.wall = wall this.$scale.val( Math.log( this.wall.background.scale ) ) }, diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 226fe98..641fa75 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -1630,6 +1630,10 @@ input[type="range"]::-webkit-slider-thumb { border:3px solid #000; } +.wallpaperResizeControls.disabled { + pointer-events: none; + opacity: 0.3; +} .wallpaperResizeControls input[type=range] { width: 130px; position: relative; -- cgit v1.2.3-70-g09d2