diff options
| author | Julie Lala <jules@okfoc.us> | 2014-10-16 02:21:46 -0400 |
|---|---|---|
| committer | Julie Lala <jules@okfoc.us> | 2014-10-16 02:33:59 -0400 |
| commit | c13532ec95c2d410354f7d342df70fd68dd78272 (patch) | |
| tree | 490509cee5ea68196c81c67fb8af5c6fea06e0d1 /public/assets/javascripts/ui/editor/Presets.js | |
| parent | 513a272520222784d67dc22c1ac833aa47a9c844 (diff) | |
matrix mode
Diffstat (limited to 'public/assets/javascripts/ui/editor/Presets.js')
| -rw-r--r-- | public/assets/javascripts/ui/editor/Presets.js | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js index a3dc610..c34c826 100644 --- a/public/assets/javascripts/ui/editor/Presets.js +++ b/public/assets/javascripts/ui/editor/Presets.js @@ -19,8 +19,9 @@ var Presets = View.extend({ outline: [0,0,0], floor: [109,116,106], ceiling: [159,163,157], + background: [109,116,106], }, - pfunk: { + "p.funk": { wall: [255,63,78], outline: [255,246,0], floor: [255,255,0], @@ -32,10 +33,24 @@ var Presets = View.extend({ floor: [0,0,0], ceiling: [0,0,0], }, + matrix: { + wall: { src: "http://bibleway.biz/images/Matrix1.gif", scale: 4.0, color: [0,0,0] }, + outline: [0,0,0], + floor: [10,15,10], + ceiling: [0,0,0], + }, }, initialize: function(opt){ this.parent = opt.parent + + this.$presets = this.$(".presets") + _.keys(this.presets).forEach(function(name){ + var $swatch = $("<span>") + $swatch.html(capitalize(name)) + $swatch.data('preset', name) + this.$presets.append($swatch) + }.bind(this)) }, toggle: function(state){ @@ -54,9 +69,9 @@ var Presets = View.extend({ selectPreset: function(e){ var preset = $(e.currentTarget).data('preset') if (! this.presets[preset]) return - this.parent.colorControl.load(this.presets[preset]) this.$(".active").removeClass('active') $(e.currentTarget).addClass('active') + this.load(this.presets[preset]) }, selectColor: function(e){ @@ -64,4 +79,24 @@ var Presets = View.extend({ console.log(preset) }, + lastPreset: {wall:[1],outline:[1],floor:[1],ceiling:[1]}, + load: function(preset){ + this.parent.colorControl.modes.forEach(function(mode){ + if (! preset[mode].length) { + Walls.setWallpaper[mode](preset[mode]) + Walls.setColor[mode](preset[mode].color) + } + else { + if (! this.lastPreset[mode].length) { + Walls.clearWallpaper[mode]() + } + Walls.setColor[mode](preset[mode]) + this.parent.colorControl.$swatch[ mode ].css("background-color", rgb_string(preset[mode])) + } + }.bind(this)) + this.parent.colorControl.setMode(preset.wall.color ? "wall" : "floor") + Walls.setBodyColor() + this.lastPreset = preset + }, + })
\ No newline at end of file |
