diff options
| author | ryderr <r@okfoc.us> | 2014-10-15 11:14:22 -0400 |
|---|---|---|
| committer | ryderr <r@okfoc.us> | 2014-10-15 11:14:22 -0400 |
| commit | 0b088a46f0c60169225627fa45ec903b4384a61c (patch) | |
| tree | 32853d0f0ceb27b834ac65ff0618d1296a0cb86d /public/assets/javascripts/ui/editor/Presets.js | |
| parent | d047149104c82bd86b3ec430c688d7653c36767d (diff) | |
| parent | 72ea86e603793ac17a9113ab031d31b369f74a4f (diff) | |
Merge branch 'master' of github.com:okfocus/vvalls
Diffstat (limited to 'public/assets/javascripts/ui/editor/Presets.js')
| -rw-r--r-- | public/assets/javascripts/ui/editor/Presets.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/editor/Presets.js b/public/assets/javascripts/ui/editor/Presets.js index a7e92b6..1e70aa2 100644 --- a/public/assets/javascripts/ui/editor/Presets.js +++ b/public/assets/javascripts/ui/editor/Presets.js @@ -2,8 +2,26 @@ var Presets = View.extend({ el: "#presets", events: { + "mousedown": "stopPropagation", "click .presets span": "selectPreset", + "click .swatches span": "selectColor", }, + + colors: [ + [255,94,58], + [255,149,0], + [255,219,76], + [76,217,100], + [52,170,220], + [29,98,240], + [198,68,252], + [0,0,0], + [74,74,74], + [125,126,127], + [209,211,212], + [235,235,235], + [255,255,255], + ], presets: { wireframe: { @@ -34,6 +52,13 @@ var Presets = View.extend({ initialize: function(opt){ this.parent = opt.parent + this.$colors = this.$(".colors") + this.colors.forEach(function(color){ + var $swatch = $("<span>") + $swatch.css("background-color","rgb(" + color + ")") + $swatch.data('color', color) + this.$colors.append($swatch) + }.bind(this)) }, toggle: function(state){ @@ -56,4 +81,9 @@ var Presets = View.extend({ $(e.currentTarget).addClass('active') }, + selectColor: function(e){ + var preset = $(e.currentTarget).data('color') + console.log(preset) + }, + })
\ No newline at end of file |
